:suspended, :banned, :inactive event :activate do transitions from: :registered, to: :active end event :suspend do transitions from: :active, to: :suspended end event :unsuspend do transitions from: :suspended, to: :active end event :ban do transitions from: [:active, :suspended], to: :banned end event :deactivate do transitions from: [:active, :suspended], to: :inactive end end user.rbͷaasm࣮෦(؆қίʔυ)
nil) }, class_name: ‘UserSuspension' aasm do … event :suspend do transitions from: :active, to: :suspended, guard: :without_active_suspension? after do suspensions.create! end end … end def without_active_suspension? return false if active_suspension true end user.rbͷౚ࣮݁෦