【发布时间】:2014-09-18 11:22:49
【问题描述】:
所以我的项目中有多个模型,其中许多模型具有激活和停用功能,我使用 AASM 进行管理
aasm column: 'status' do
state :active, :initial => true
state :inactive
event :deactivate do
transitions :from => :active, :to => :inactive
end
event :activate do
transitions :from => :inactive, :to => :active
end
end
我想避免重复这段代码,它有 4 种不同的模型,我可能不会再向它们添加任何状态。
提前致谢
【问题讨论】:
标签: ruby-on-rails aasm