get list of state_machine states

青春壹個敷衍的年華 提交于 2019-11-28 07:08:54

Something like:

User.state_machine.states.map &:name

Just to add to this (because I'm constantly searching for this answer, and I always come back to this page), if you are trying to list the states for a giving state machine, try this:

Discussion.state_machines[:name_of_state].states.map &:name

If you name your state field differently , such as publish_status

Article.state_machines[:publish_status].states.map &:name
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!