Sha256: d5e949e44d8c7515ff6312915e2eabbcb5ee5c11b10fffedf71ab67be497bfe6

Contents?: true

Size: 439 Bytes

Versions: 40

Compression:

Stored size: 439 Bytes

Contents

module ActiveModel
  module Dirty
    def can_change_primary_key?
      true
    end

    def primary_key_changed?
      !!changed.detect { |key| ids_hash.keys.include?(key.to_s) }
    end

    def primary_key_was
      ids_hash.keys.inject(Hash.new) do |result, attribute_name|
        result[attribute_name] = attribute_was(attribute_name.to_s)
        result
      end
    end
    alias_method :ids_hash_was, :primary_key_was
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
composite_primary_keys-7.0.9 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.8 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.7 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.6 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.5 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.4 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.3 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.2 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.1 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.0 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.6 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.5 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.3 lib/composite_primary_keys/dirty.rb
composite_primary_keys-5.0.14 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.1 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.0 lib/composite_primary_keys/dirty.rb
composite_primary_keys-5.0.13 lib/composite_primary_keys/dirty.rb
composite_primary_keys-5.0.12 lib/composite_primary_keys/dirty.rb
composite_primary_keys-5.0.11 lib/composite_primary_keys/dirty.rb
composite_primary_keys-5.0.10 lib/composite_primary_keys/dirty.rb