module AASM::Persistence::ORM
def aasm_fire_event(state_machine_name, name, options, *args, &block)
def aasm_fire_event(state_machine_name, name, options, *args, &block) return super unless aasm_supports_transactions? && options[:persist] event = self.class.aasm(state_machine_name).state_machine.events[name] event.fire_callbacks(:before_transaction, self, *args) event.fire_global_callbacks(:before_all_transactions, self, *args) begin success = if options[:persist] && use_transactions?(state_machine_name) aasm_transaction(requires_new?(state_machine_name), requires_lock?(state_machine_name)) do super end else super end if success && !(event.options.keys & [:after_commit, :after_all_commits]).empty? aasm_execute_after_commit do event.fire_callbacks(:after_commit, self, *args) event.fire_global_callbacks(:after_all_commits, self, *args) end end success ensure event.fire_callbacks(:after_transaction, self, *args) event.fire_global_callbacks(:after_all_transactions, self, *args) end end