我有一个模型如下
class Inspection < ActiveRecord::Base
include AASM
aasm_column :status #aasm in 'status' field
aasm_initial_state :new
aasm_state :new
aasm_state :inprocess
aasm_state :complete
aasm_state :approved
aasm_event :inprocess do
transitions :to => :inprocess, :from => :new
end
aasm_event :complete do
transitions :to => :complete, :from => :inprocess
end
aasm_event :approve do
transitions :to => :approved, :from => :complete
end
aasm_column :sharing_status #aasm in 'sharing_status' field
aasm_initial_state :not_shared
aasm_state :not_shared
aasm_state :shared
aasm_state :revoked
aasm_event :share do
transitions :to => :shared, :from => :not_shared
end
aasm_event :revoke do
transitions :to => :revoked, :from => :shared
end
.....
end
我想在Inspection的两个不同模型字段上实现不同的 aasm 状态和转换。第一个转换在上面的代码中不起作用(如果存在第二个状态和转换)。如何解决?