instance method _read_attribute

Ruby on Rails 3.1.12

Since v3.0.20 Last seen in v6.1.7.10

Available in: v3.0.20 v3.1.12 v6.0.6 v6.1.7.10

Signature

_read_attribute(attr_name)

No documentation comment.

Parameters

attr_name req
Source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 110
      def _read_attribute(attr_name)
        attr_name = attr_name.to_s
        attr_name = self.class.primary_key if attr_name == 'id'
        value = @attributes[attr_name]
        unless value.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
        end
      end

Defined in activerecord/lib/active_record/attribute_methods/read.rb line 110 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::AttributeMethods::Read

Type at least 2 characters to search.

↑↓ navigate · open · esc close