我是 Rails 新手,我正在做一个包含此代码的项目
aasm_column :status
aasm do
state :unregistered, initial: true
state :pending, enter: :enter_pending_state
state :activated, enter: :enter_activated_state
state :disabled
event :register do
transitions from: :unregistered, to: :pending, guard: :valid?
end
event :activate do
transitions from: [ :unregistered, :pending ], to: :activated
transitions from: :pending, to: :activated, guard: :valid?
end
event :disable do
transitions from: [ :pending, :activated ], to: :disabled, guard: :valid?
end
event :enable do
transitions from: :disabled, to: :activated, guard: Proc.new { |u| u.activation_code.blank? && u.valid? }
transitions from: :disabled, to: :pending, guard: Proc.new { |u| !u.activation_code.blank? && u.valid? }
end
end
before_create :enter_pending_state, if: Proc.new{|u| u.pending? }
aasm_column 是什么意思,这样做的陈词滥调是什么