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

Validation with state as constant aren't working #73

Open
disastrous-charly opened this issue Oct 8, 2019 · 1 comment
Open

Validation with state as constant aren't working #73

disastrous-charly opened this issue Oct 8, 2019 · 1 comment

Comments

@disastrous-charly
Copy link

disastrous-charly commented Oct 8, 2019

Hi,
Writing this issue because I use your gem and I have one small issue :

My state are constant, like that :
STATES = [ STATE_INTERNAL_DELIVERY = 'internal_delivery', STATE_DELIVERABLES_PENDING_REVIEW = 'deliverables_pending_review', STATE_FINISHING_STEP = 'finishing_step' ].freeze

and I'm trying to do a validation with :
state STATE_FINISHING_STEP, STATE_DELIVERABLES_PENDING_REVIEW, STATE_INTERNAL_DELIVERY do validate :validate_delivery_possible end

Which will run only on the last state.

But if I do this :

state 'deliverables_pending_review', 'internal_delivery', 'finishing_step' do validate :validate_delivery_possible end

It's running as expected.

Do you know why ?

@seuros
Copy link
Member

seuros commented Oct 8, 2019

Try defining the STATE_* constants outside the array.

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