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

State value exceptions? #18

Closed
zaqwery opened this issue Feb 1, 2011 · 1 comment
Closed

State value exceptions? #18

zaqwery opened this issue Feb 1, 2011 · 1 comment

Comments

@zaqwery
Copy link

zaqwery commented Feb 1, 2011

In my model I had
include ActiveRecord::Transitions
state_machine do
state :submitted
state :valid
state :hidden
state :banned
end
And kept getting wrong number of arguments (1 for 0) until I renamed :valid to :validated . That closed an issue although word 'valid' isn't one of Ruby or Rails reserved words. There are many word exceptions for SQL databases but is that related to the particular field's value?

@qoobaa
Copy link
Collaborator

qoobaa commented Feb 3, 2011

You should avoid using the same names in your state machine that AR implements as methods in your model. If you create state "valid", few additional methods will be created in your model (e.g. "valid?"), which will most probably break validations in your model. It's not a bug of Transitions.

This issue was closed.
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

No branches or pull requests

2 participants