Created
September 11, 2013 14:44
-
-
Save PDegenPortnoy/6524642 to your computer and use it in GitHub Desktop.
Acts As State Machine (AASM) with callback sample code that was initial, non-functioning, implementation
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 do | |
transitions :to => :active, | |
:from => [:inactive], | |
:after => :after_event | |
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