Skip to content

Commit

Permalink
added after_commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Cohnen committed Oct 22, 2013
1 parent 86c24c4 commit 9f9bb07
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/aasm/persistence/active_record_persistence.rb
Expand Up @@ -132,9 +132,16 @@ def aasm_ensure_initial_state
end

def aasm_fire_event(name, options, *args)
self.class.transaction(:requires_new => true) do
success = self.class.transaction(:requires_new => true) do
super
end

if success
new_state = aasm.state_object_for_name(aasm.current_state)
new_state.fire_callbacks(:after_commit, self)
end

success
end
end # InstanceMethods

Expand Down

0 comments on commit 9f9bb07

Please sign in to comment.