-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class.human_state_name stops returning real human name after transition #246
Comments
Hey @iabdulin - Any chance the code that's referencing the state name is modifying the string in-place? I can't reproduce in a simple example using state_machine 1.2.0: require 'state_machine'
class Ticket
state_machine do
event :next_step do
transition :new => :issue_details_collected
transition :issue_details_collected => :carrier_details_collected
transition :carrier_details_collected => :closed
end
state :new, :human_name => 'Issue Details'
state :issue_details_collected, :human_name => 'Carrier Details' do
end
state :carrier_details_collected, :human_name => 'Resolution' do
end
state :closed, :human_name => 'Closed' do
end
end
end
Ticket.human_state_name(:issue_details_collected) # => "Carrier Details"
ticket = Ticket.new # => #<Ticket:0x87c6e1c>
ticket.state = 'new' # => "new"
ticket.next_step # => true
Ticket.human_state_name(:issue_details_collected) # => "Carrier Details" If you could provide a reproducible example or ensure that no other code is referencing the human name value, that'd be great. There's really nothing special that state_machine is doing with that string under the hood. |
Here's the example repo: |
@iabdulin Awesome find... looks like it has to do with the ActiveModel integration assuming that you'll be specifying the human name option in the locale. I'll look into fixing this over the next week or so. |
I've updated the repo with another test. |
Just FYI -- haven't forgotten about this .. just been a little busy lately. |
cool |
is solution ready? |
In Ticket.rb I have
In console:
What's wrong?
The text was updated successfully, but these errors were encountered: