以下是我的booking
模型中定义的状态。
第一状态
aasm :booking_state,namespace: :booking_state, skip_validation_on_save: true, :whiny_transitions => false do
state :pending, initial: true
state :some_other_states
end
第二状态
aasm :payment_state,namespace: :payment_state, skip_validation_on_save: true, :whiny_transitions => false do
state :pending, initial: true
state :some_other_states
end
现在,如果我这样做booking.aasm(:booking_state).current_state
,它会返回正确的state
名称。
但如果我这样做booking.aasm(:booking_state).pending?
,它会返回下面error
而不是布尔值。
`NoMethodError: undefined method `pending?' for #<AASM::InstanceBase:0x005611e58e4cf0>`
这里可能是什么问题?我知道我是否只使用one
state
每个模型这有效。multiple states
但在使用每个模型时不起作用。