Module: Changebase::Inline::ActiveRecord::PostgreSQLAdapter
- Defined in:
- lib/changebase/inline/active_record.rb
Instance Attribute Summary collapse
-
#changebase_transaction ⇒ Object
readonly
Returns the value of attribute changebase_transaction.
Instance Method Summary collapse
-
#begin_db_transaction ⇒ Object
Begins a transaction.
-
#commit_db_transaction ⇒ Object
Commits a transaction.
-
#exec_rollback_db_transaction ⇒ Object
Aborts a transaction.
Instance Attribute Details
#changebase_transaction ⇒ Object (readonly)
Returns the value of attribute changebase_transaction.
67 68 69 |
# File 'lib/changebase/inline/active_record.rb', line 67 def changebase_transaction @changebase_transaction end |
Instance Method Details
#begin_db_transaction ⇒ Object
Begins a transaction.
70 71 72 73 74 75 76 |
# File 'lib/changebase/inline/active_record.rb', line 70 def begin_db_transaction super @changebase_transaction = Changebase::Inline::Transaction.new( timestamp: Time.current, metadata: @changebase_metadata ) end |
#commit_db_transaction ⇒ Object
Commits a transaction.
86 87 88 89 90 |
# File 'lib/changebase/inline/active_record.rb', line 86 def commit_db_transaction @changebase_transaction&.save! @changebase_transaction = nil super end |
#exec_rollback_db_transaction ⇒ Object
Aborts a transaction.
79 80 81 82 83 |
# File 'lib/changebase/inline/active_record.rb', line 79 def exec_rollback_db_transaction super ensure @changebase_transaction = nil end |