Module: ArTransactionChanges
- Defined in:
- lib/ar_transaction_changes.rb,
lib/ar_transaction_changes/version.rb
Constant Summary collapse
- VERSION =
"1.1.9"
Instance Method Summary collapse
- #_run_commit_callbacks ⇒ Object
- #_run_rollback_callbacks ⇒ Object
- #_write_attribute(attr_name, value) ⇒ Object
- #attribute_will_change!(attr_name) ⇒ Object
- #transaction_changed_attributes ⇒ Object
- #write_attribute(attr_name, value) ⇒ Object
Instance Method Details
#_run_commit_callbacks ⇒ Object
7 8 9 10 11 |
# File 'lib/ar_transaction_changes.rb', line 7 def _run_commit_callbacks super ensure @transaction_changed_attributes = nil end |
#_run_rollback_callbacks ⇒ Object
13 14 15 16 17 |
# File 'lib/ar_transaction_changes.rb', line 13 def _run_rollback_callbacks super ensure @transaction_changed_attributes = nil end |
#_write_attribute(attr_name, value) ⇒ Object
23 24 25 26 27 |
# File 'lib/ar_transaction_changes.rb', line 23 def _write_attribute(attr_name, value) _store_transaction_changed_attributes(attr_name) do super(attr_name, value) end end |
#attribute_will_change!(attr_name) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/ar_transaction_changes.rb', line 37 def attribute_will_change!(attr_name) unless transaction_changed_attributes.key?(attr_name) value = _read_attribute_for_transaction(attr_name) value = _deserialize_transaction_change_value(attr_name, value) transaction_changed_attributes[attr_name] = value end super end |
#transaction_changed_attributes ⇒ Object
19 20 21 |
# File 'lib/ar_transaction_changes.rb', line 19 def transaction_changed_attributes @transaction_changed_attributes ||= HashWithIndifferentAccess.new end |
#write_attribute(attr_name, value) ⇒ Object
30 31 32 33 34 |
# File 'lib/ar_transaction_changes.rb', line 30 def write_attribute(attr_name, value) _store_transaction_changed_attributes(attr_name) do super(attr_name, value) end end |