Sha256: 30eccd97c4b4b2758f2fd9035676cdd3f22e3d5464f9b027850f78d575b23440

Contents?: true

Size: 408 Bytes

Versions: 15

Compression:

Stored size: 408 Bytes

Contents

module ActiveRecord
  module AttributeMethods #:nodoc:
    module PrimaryKey
      def to_key
        # CPK
        #key = send(self.class.primary_key)
        #[key] if key

        primary_key = self.class.primary_key
        if primary_key.is_a?(Array)
          primary_key.collect{|k| send(k)}
        else
          key = send(primary_key)
          [key] if key
        end
      end
    end
  end
end

Version data entries

15 entries across 14 versions & 1 rubygems

Version Path
composite_primary_keys-3.1.11 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.10 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.9 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.8 lib/composite_primary_keys/attribute_methods/primary_key.rb
composite_primary_keys-3.1.8 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.7 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.6 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.5 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.4 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.2 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.1 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.1.0 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.0.9 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.0.8 lib/composite_primary_keys/primary_key.rb
composite_primary_keys-3.0.7 lib/composite_primary_keys/primary_key.rb