Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8021217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:55:04+00:00 2026-06-04T21:55:04+00:00

I use gem state_machine – Official Each state can have ‘human name’. By docs

  • 0

I use gem state_machine – Official

Each state can have ‘human name’. By docs and APIs i’ve tried:

in my_model.rb

state_machine :initial => :new do
    state :new, :human_name => 'Added and not accepted'
    ...

in my_view.haml

%p= MyModel.human_state_name(@item.state_name)
%p= @item.human_state_name

both variants return just ‘new’ instead of ‘Added and not accepted’. What I should do? I’ve made mistake in setting human_name or in getting human_name?

Update
Works in:

en:
  activerecord:
    state_machines:
      mymodel: # model name
        states:
          new: 'Added and not accepted' # state name
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:55:05+00:00Added an answer on June 4, 2026 at 9:55 pm

    You don’t need to pass :human_name option to state machine. Just define translations for your language:

    en:
      activerecord:
        state_machines:
          mymodel: # model name
            state: # state name
              states:
                new: 'Added and not accepted'
              events: # you can also define translations for the events
                some_event: 'put custom translation here'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so I have this project in RoR where I use sorcery gem for register
I have a User model, which has a state. The state can be either
Normally I use: gem install rails I can install Rails on Windows, but by
Say I have a gem living happily at: /MyPath/MyGem.gem And I want to use
I need to use pdfkit gem. I have installed gem, and wkhtmltopdftool as written
Reading the documentation for the spawn gem it states: By default, spawn will use
I use gem 'sqlite3', '1.3.5' on dev and gem 'pg', '0.12.2' on prod. ruby
I am trying to use IMGKit gem. So I need to install wkhtmtopdf software.
I am plannning to use whenever gem which among other things will also run
I'm trying to use Paperclip gem and store the documents on Amazon S3. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.