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-9.0.4 lib/composite_primary_keys/dirty.rb
composite_primary_keys-9.0.2 lib/composite_primary_keys/dirty.rb
composite_primary_keys-9.0.1 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.1.4 lib/composite_primary_keys/dirty.rb
composite_primary_keys-9.0.0 lib/composite_primary_keys/dirty.rb
composite_primary_keys-9.0.0.beta1 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.1.3 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.1.2 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.16 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.15 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.1.1 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.14 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.1.0 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.13 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.8 lib/composite_primary_keys/dirty.rb
composite_primary_keys-8.0.0 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.12 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.11 lib/composite_primary_keys/dirty.rb
composite_primary_keys-6.0.7 lib/composite_primary_keys/dirty.rb
composite_primary_keys-7.0.10 lib/composite_primary_keys/dirty.rb