diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-02 20:05:06 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-02 20:28:28 -0200 |
commit | 21eadc1b3f2eb818a4833381ee0a6cfa205f2955 (patch) | |
tree | a3353dfa114f1d4d61e9447825b2fb4ada792c9b /activerecord/lib/active_record | |
parent | 42c51b8527e49ae2d7a0f6cc009e53865b7910c1 (diff) | |
download | rails-21eadc1b3f2eb818a4833381ee0a6cfa205f2955.tar.gz rails-21eadc1b3f2eb818a4833381ee0a6cfa205f2955.tar.bz2 rails-21eadc1b3f2eb818a4833381ee0a6cfa205f2955.zip |
Base#[] and Base#[]= are aliases so implement them as aliases :)
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6573cd5e89..ba7f6f0129 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1460,19 +1460,6 @@ MSG @attributes.keys end - # Returns the value of the attribute identified by <tt>attr_name</tt> 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). - def [](attr_name) - read_attribute(attr_name) - end - - # Updates the attribute identified by <tt>attr_name</tt> with the specified +value+. - # (Alias for the protected write_attribute method). - def []=(attr_name, value) - write_attribute(attr_name, value) - end - # Allows you to set all the attributes at once by passing in a hash with keys # matching the attribute names (which again matches the column names). # @@ -1873,6 +1860,17 @@ MSG include Aggregations, Transactions, Reflection, Serialization NilClass.add_whiner(self) if NilClass.respond_to?(:add_whiner) + + # Returns the value of the attribute identified by <tt>attr_name</tt> 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 + + # Updates the attribute identified by <tt>attr_name</tt> with the specified +value+. + # (Alias for the protected write_attribute method). + alias []= write_attribute + + public :[], :[]= end end |