Class: ActiveRecord::ConnectionAdapters::Transaction::Callback
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Transaction::Callback
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Overview
:nodoc:
Instance Method Summary collapse
- #after_commit ⇒ Object
- #after_rollback ⇒ Object
- #before_commit ⇒ Object
-
#initialize(event, callback) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(event, callback) ⇒ Callback
Returns a new instance of Callback.
130 131 132 133 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 130 def initialize(event, callback) @event = event @callback = callback end |
Instance Method Details
#after_commit ⇒ Object
139 140 141 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 139 def after_commit @callback.call if @event == :after_commit end |
#after_rollback ⇒ Object
143 144 145 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 143 def after_rollback @callback.call if @event == :after_rollback end |
#before_commit ⇒ Object
135 136 137 |
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 135 def before_commit @callback.call if @event == :before_commit end |