mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
added after_commit hook
This commit is contained in:
parent
86c24c4082
commit
9f9bb07bc4
1 changed files with 8 additions and 1 deletions
|
@ -132,9 +132,16 @@ module AASM
|
||||||
end
|
end
|
||||||
|
|
||||||
def aasm_fire_event(name, options, *args)
|
def aasm_fire_event(name, options, *args)
|
||||||
self.class.transaction(:requires_new => true) do
|
success = self.class.transaction(:requires_new => true) do
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if success
|
||||||
|
new_state = aasm.state_object_for_name(aasm.current_state)
|
||||||
|
new_state.fire_callbacks(:after_commit, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
success
|
||||||
end
|
end
|
||||||
end # InstanceMethods
|
end # InstanceMethods
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue