Skip to content
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

Warning when using ActiveRecord and defaults are the same #285

Open
devdazed opened this issue Oct 18, 2013 · 0 comments · May be fixed by #293
Open

Warning when using ActiveRecord and defaults are the same #285

devdazed opened this issue Oct 18, 2013 · 0 comments · May be fixed by #293

Comments

@devdazed
Copy link

getting the warning

Both MyModel and its :my_machine machine have defined a different default for "my_state". Use only one or the other for defining defaults to avoid unexpected behaviors.

when setting values for the default as such

state_machine :my_machine, :initial => :my_state, :namespace => 'the_name' do
  state :my_state, :value => 0
  state :my_other_state, :value => 1
end

In this case the database default for the model is 0. Upon further inspection, state machine is attempting to compare the string my_state with the model default of 0 rather than using the value specified for the state name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant