aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-09-02 08:31:11 +0000
committerJamis Buck <jamis@37signals.com>2005-09-02 08:31:11 +0000
commit69d662051e609f8fc3e28d2c77a917cd0befddca (patch)
treed87ffe6b3df701eee9fbf22ccc43a5ff9cf4b864 /activerecord/lib
parent46c4fd4177550142b3071806376e3df4ac1b4d2e (diff)
downloadrails-69d662051e609f8fc3e28d2c77a917cd0befddca.tar.gz
rails-69d662051e609f8fc3e28d2c77a917cd0befddca.tar.bz2
rails-69d662051e609f8fc3e28d2c77a917cd0befddca.zip
Modify read_attribute to allow a symbol argument #2024 [Ken Kunz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index e31987473e..6180f45fed 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1108,13 +1108,13 @@ module ActiveRecord #:nodoc:
# "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.to_s)
+ 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.to_s, value)
+ write_attribute(attr_name, value)
end
# Allows you to set all the attributes at once by passing in a hash with keys
@@ -1267,6 +1267,7 @@ module ActiveRecord #:nodoc:
# Returns the value of attribute identified by <tt>attr_name</tt> after it has been type cast (for example,
# "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)).
def read_attribute(attr_name)
+ attr_name = attr_name.to_s
if !(value = @attributes[attr_name]).nil?
if column = column_for_attribute(attr_name)
if unserializable_attribute?(attr_name, column)