diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d62a40d7ea559..60cbdd0a0dcb6 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2173,13 +2173,15 @@ def clear_timestamp_attributes # 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). - alias [] read_attribute + def [](attr_name) + read_attribute(attr_name) + end # Updates the attribute identified by attr_name with the specified +value+. # (Alias for the protected write_attribute method). - alias []= write_attribute - - public :[], :[]= + def []=(attr_name, value) + write_attribute(attr_name, value) + end end end