Sha256: cbbd96dbc7218272f7b981a412fb73be6c4bd0a607d18b2e8ec48ba31d61408e

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

require "ar_transaction_changes/version"

module ArTransactionChanges
  def run_callbacks(kind, &block)
    ret = super
    case kind.to_sym
    when :create, :update
      store_transaction_changed_attributes if ret != false
    when :commit, :rollback
      @transaction_changed_attributes = nil
    end

    ret
  end

  def transaction_changed_attributes
    changed_attributes.merge(@transaction_changed_attributes || {})
  end

  private

  def store_transaction_changed_attributes
    @transaction_changed_attributes = transaction_changed_attributes
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ar_transaction_changes-1.0.0 lib/ar_transaction_changes.rb