instance method []

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v3.0.20

Available in: v2.2.3 v2.3.18 v3.0.20

Signature

[](attr_name)

Returns the value of the attribute identified by attr_name after it has been typecast (for example, “2004-12-12” in a data column is cast to a date object, like Date.new(2004, 12, 12)). (Alias for the protected read_attribute method).

Parameters

attr_name req
Source
# File activerecord/lib/active_record/base.rb, line 2759
      def [](attr_name)
        read_attribute(attr_name)
      end

Defined in activerecord/lib/active_record/base.rb line 2759 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close