Class: ActiveRecord::ConnectionAdapters::SavepointTransaction
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::SavepointTransaction
- Defined in:
- lib/prefactory/active_record_integration.rb
Instance Method Summary collapse
- #perform_commit ⇒ Object
-
#perform_rollback ⇒ Object
If the savepoint was already released, we have an exception in an after-commit callback.
Instance Method Details
#perform_commit ⇒ Object
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_rollback ⇒ Object
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 |