Sha256: df15524abaf76f3c61359d1baf32cb80f1402991df041fba790be9914e20e7e7

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

module ActiveRecord
  module AttributeMethods
    module PrimaryKey
      silence_warnings do
        # Returns the primary key previous value.
        def id_was
          sync_with_transaction_state
          # CPK
          # attribute_was(self.class.primary_key)
          if self.composite?
            self.class.primary_keys.map do |key_attr|
              attribute_was(key_attr)
            end
          else
            attribute_was(self.class.primary_key)
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
composite_primary_keys-9.0.10 lib/composite_primary_keys/attribute_methods/primary_key.rb
composite_primary_keys-9.0.9 lib/composite_primary_keys/attribute_methods/primary_key.rb