Created
December 13, 2010 06:50
-
-
Save rwz/738734 to your computer and use it in GitHub Desktop.
state_machine + delayed_job wtf
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
# doesn't fucking work | |
class Logo < ActiveRecord::Base | |
state_machine :state, :initial => :initial do | |
# here vvv | |
after_transition :initial => :used, :do => :test_callback | |
# here ^^^ | |
event :use do | |
transition :initial => :used | |
end | |
end | |
def test_callback | |
raise 'Fuck' | |
end | |
handle_asynchronously :test_callback | |
end |
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
# works | |
class Logo < ActiveRecord::Base | |
state_machine :state, :initial => :initial do | |
# here vvv | |
after_transition :initial => :used do |logo, t| | |
logo.test_callback | |
end | |
# here ^^^ | |
event :use do | |
transition :initial => :used | |
end | |
end | |
def test_callback | |
raise 'Fuck' | |
end | |
handle_asynchronously :test_callback | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!