Created
October 25, 2017 10:56
-
-
Save pashagray/3ee844a82a42f497ae62eeb89c650274 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
include AASM | |
aasm do | |
state :newone, initial: true | |
state :activated | |
state :blocked | |
state :deleted | |
event :activate do | |
transitions from: :newone, to: :activated | |
end | |
event :block do | |
transitions from: :activated, to: :blocked | |
end | |
event :unblock do | |
transitions from: :blocked, to: :activated | |
end | |
event :delete do | |
transitions from: [:newone, :activated, :blocked], to: :deleted | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment