diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-11 06:10:22 -0800 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-11 12:10:59 -0200 |
commit | bb78804a5e382bde072186e80062f7df9f20ecc8 (patch) | |
tree | 215195f2b11265372259fb1627d36b6fe10b0406 /activerecord/lib | |
parent | 9c88005d9766a853839adbab4acf77660b6cfb8b (diff) | |
download | rails-bb78804a5e382bde072186e80062f7df9f20ecc8.tar.gz rails-bb78804a5e382bde072186e80062f7df9f20ecc8.tar.bz2 rails-bb78804a5e382bde072186e80062f7df9f20ecc8.zip |
Merge pull request #4408 from tomstuart/read-and-write-attribute-aliases
#[] and #[]= are no longer interchangeable with #read_attribute and #write_attribute
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 883440542d..54086a8fbb 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -21,13 +21,15 @@ module ActiveRecord # 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 + 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). - alias []= write_attribute - - public :[], :[]= + def []=(attr_name, value) + write_attribute(attr_name, value) + end end module ClassMethods |