Revert "cleaning up internal firing of event callbacks (make things clearer)"

This reverts commit 38ce01e02f.
This commit is contained in:
Thorsten Böttger 2013-02-21 21:06:30 +13:00
parent 38ce01e02f
commit 497e14e22d
1 changed files with 13 additions and 9 deletions

View File

@ -41,15 +41,10 @@ module AASM
end
def fire_callbacks(action, record)
callbacks = @options[action]
Array(callbacks).each do |callback|
case callback
when Symbol, String
record.send(callback)
when Proc
record.instance_eval(&callback)
end
end
action = @options[action]
action.is_a?(Array) ?
action.each {|a| _fire_callbacks(a, record)} :
_fire_callbacks(action, record)
end
def ==(event)
@ -128,6 +123,15 @@ module AASM
result
end
def _fire_callbacks(action, record)
case action
when Symbol, String
record.send(action)
when Proc
record.instance_eval &action
end
end
def transitions(trans_opts)
# Create a separate transition for each from state to the given state
Array(trans_opts[:from]).each do |s|