Class: ActiveRecord::ConnectionAdapters::SavepointTransaction

Inherits:
Object
  • Object
show all
Defined in:
lib/prefactory/active_record_integration.rb

Instance Method Summary collapse

Instance Method Details

#perform_commitObject



77
78
79
80
81
82
83
84
85
# File 'lib/prefactory/active_record_integration.rb', line 77

def perform_commit
  connection.release_savepoint
  if @fake_commit
    @savepoint_already_released = true
    commit_records
  else
    records.each { |r| parent.add_record(r) }
  end
end

#perform_rollbackObject

If the savepoint was already released, we have an exception in an after-commit callback. That means this transaction cannot and should not be rolled back, unlike the parent transactions, which will roll back as the exception bubbles upwards.



70
71
72
73
74
75
# File 'lib/prefactory/active_record_integration.rb', line 70

def perform_rollback
  unless @savepoint_already_released
    connection.rollback_to_savepoint
    rollback_records
  end
end