Below are the states defined in my booking
model.
1st state
aasm :booking_state,namespace: :booking_state, skip_validation_on_save: true, :whiny_transitions => false do
state :pending, initial: true
state :some_other_states
end
2nd state
aasm :payment_state,namespace: :payment_state, skip_validation_on_save: true, :whiny_transitions => false do
state :pending, initial: true
state :some_other_states
end
Now if I do booking.aasm(:booking_state).current_state
it returns the proper state
name.
But if I do booking.aasm(:booking_state).pending?
it returns below error
instead of boolean value.
`NoMethodError: undefined method `pending?' for #<AASM::InstanceBase:0x005611e58e4cf0>`
What could be the issue here? I know if I only use one
state
per model this works. But not working when using multiple states
per model.
Master branch of aasm declares methods like "#{namespace}_#{state}?"
when the namespace is specified.
That said, booking.booking_state_pending?
would work.