Skip to content

Instantly share code, notes, and snippets.

@pashagray
Created October 25, 2017 10:56
Show Gist options
  • Save pashagray/3ee844a82a42f497ae62eeb89c650274 to your computer and use it in GitHub Desktop.
Save pashagray/3ee844a82a42f497ae62eeb89c650274 to your computer and use it in GitHub Desktop.
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