human_name for state in state_machine ruby gem
ruby, ruby-on-rails-3
Solution
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'
Problem
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 ```