Sha256: 3d6e1b3fc9c0fbd3dfea79f2c5234873608919ad91f4c1086c6881e720709928

Contents?: true

Size: 695 Bytes

Versions: 19

Compression:

Stored size: 695 Bytes

Contents

module ActiveRecord
  module AttributeMethods
    module Read
      def read_attribute(attr_name)
        attr_name = attr_name.to_s
        # CPK
        # attr_name = self.class.primary_key if attr_name == 'id'
        attr_name = self.class.primary_key if (attr_name == 'id' and !self.composite?)
        if !(value = @attributes[attr_name]).nil?
          if column = column_for_attribute(attr_name)
            if unserializable_attribute?(attr_name, column)
              unserialize_attribute(attr_name)
            else
              column.type_cast(value)
            end
          else
            value
          end
        else
          nil
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
composite_primary_keys-3.1.11 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.10 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.9 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.8 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.7 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.6 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.5 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.4 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.2 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.1 lib/composite_primary_keys/read.rb
composite_primary_keys-3.1.0 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.9 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.8 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.7 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.4 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.3 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.0.b3 lib/composite_primary_keys/read.rb
composite_primary_keys-3.0.0.b2 lib/composite_primary_keys/read.rb
globe-composite_primary_keys-3.0.1 lib/composite_primary_keys/read.rb