列出状态机中的所有状态
List ALL states within States Machine
如何从 CardHolderStateMachine 获取所有可能状态的数组?
到目前为止,我只有两个(:pending
和 :active
),但我想抓住它们在下拉列表中使用。
class CardHolderStateMachine
include Statesman::Machine
state :pending, initial: true
state :active
transition from: :pending, to: [:active]
"states" 我不是指美利坚合众国(只是为了避免混淆,因为有一些帖子与 Statesman 无关)
你试过了吗CardHolderStateMachine.states
?
> CardHolderStateMachine.states
=> ["pending", "active"]
检查 source code 总是有回报的。
如何从 CardHolderStateMachine 获取所有可能状态的数组?
到目前为止,我只有两个(:pending
和 :active
),但我想抓住它们在下拉列表中使用。
class CardHolderStateMachine
include Statesman::Machine
state :pending, initial: true
state :active
transition from: :pending, to: [:active]
"states" 我不是指美利坚合众国(只是为了避免混淆,因为有一些帖子与 Statesman 无关)
你试过了吗CardHolderStateMachine.states
?
> CardHolderStateMachine.states
=> ["pending", "active"]
检查 source code 总是有回报的。