Created
October 6, 2016 23:34
-
-
Save joelhooks/9ed9a326fc0aa40335adacf20910d5bb 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
aasm :column => :state do | |
state :proposed, :initial => true | |
state :cancelled | |
state :accepted | |
state :claimed | |
state :submitted | |
state :rejected | |
state :updated | |
state :approved | |
state :published | |
state :flagged | |
state :revised | |
state :retired | |
event :cancel do | |
transitions :from => [:accepted, :claimed, :submitted, :proposed, :updated], :to => :cancelled | |
end | |
event :accept do | |
transitions :from => :proposed, :to => :accepted | |
end | |
event :claim do | |
transitions :from => :accepted, :to => :claimed | |
end | |
event :submit do | |
transitions :from => :claimed, :to => :submitted | |
end | |
event :reject do | |
transitions :from => [:submitted, :updated], :to => :rejected | |
end | |
event :update do | |
transitions :from => :rejected, :to => :updated | |
end | |
event :approve do | |
transitions :from => [:submitted, :updated], :to => :approved | |
end | |
event :publish do | |
transitions :from => :revised, :to => :published | |
transitions :from => :approved, :to => :published | |
end | |
event :flag do | |
transitions :from => :published, :to => :flagged | |
end | |
event :revise do | |
transitions :from => :flagged, :to => :revised | |
end | |
event :retire do | |
transitions :from => [:published, :flagged], :to => :retired | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment