gpt4 book ai didi

ruby-on-rails - 如何从模型类中获取所有 state_machine 事件?

转载 作者:行者123 更新时间:2023-12-01 09:35:05 26 4
gpt4 key购买 nike

是否可以从模型类中获取所有事件?我想按事件过滤列表。

有一个 similar question on mailinglist关于所有的过渡。

我正在使用 https://github.com/pluginaweek/state_machine

最佳答案

在您链接到它的 github 页面上,显示了以下 API 方法:

vehicle.state_events  # shows all the events possible from the current state


vehicle.state_paths.events # shows all the events for an object

关于ruby-on-rails - 如何从模型类中获取所有 state_machine 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9564728/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com