Class: ActiveRecord::ConnectionAdapters::SavepointTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- ActiveRecord::ConnectionAdapters::SavepointTransaction
show all
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Instance Attribute Summary
Attributes inherited from Transaction
#connection, #joinable, #records, #savepoint_name, #state
Instance Method Summary
collapse
Methods inherited from Transaction
#add_record, #closed?, #commit_records, #joinable?, #open?, #rollback_records
Constructor Details
#initialize(connection, savepoint_name, options) ⇒ SavepointTransaction
113
114
115
116
117
118
119
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 113
def initialize(connection, savepoint_name, options)
super(connection, options)
if options[:isolation]
raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction"
end
connection.create_savepoint(@savepoint_name = savepoint_name)
end
|
Instance Method Details
#commit ⇒ Object
127
128
129
130
131
132
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 127
def commit
connection.release_savepoint(savepoint_name)
super
parent = connection.transaction_manager.current_transaction
records.each { |r| parent.add_record(r) }
end
|
#full_rollback? ⇒ Boolean
134
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 134
def full_rollback?; false; end
|
#rollback ⇒ Object
121
122
123
124
125
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 121
def rollback
connection.rollback_to_savepoint(savepoint_name)
super
rollback_records
end
|