Created
September 11, 2013 14:46
-
-
Save PDegenPortnoy/6524671 to your computer and use it in GitHub Desktop.
Acts As State Machine with Successful Callback structures
This file contains 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 Tester < ActiveRecord::Base | |
include AASM | |
aasm_initial_state :inactive | |
aasm_state :inactive | |
aasm_state :active, | |
:after_enter => :after_active_state | |
aasm_event :activate, | |
:after => :after_event do | |
transitions :to => :active, | |
:from => [:inactive] | |
end | |
aasm_event :pause do | |
transitions :to => :inactive, | |
:from => [:active] | |
end | |
def after_event | |
logger.debug("** after_event ") | |
end | |
def after_active_state | |
logger.debug("** after_active_state") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment