Revert "cleaning up internal firing of event callbacks (make things clearer)"
This reverts commit 38ce01e02f
.
This commit is contained in:
parent
38ce01e02f
commit
497e14e22d
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue