aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-11 14:36:06 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-11 14:36:06 -0700
commit51157c9b46cb200b45554700dae3b4026f268b7f (patch)
tree29eac3609760d2bc2e16f327171102ff92c47c75 /activerecord/lib/active_record/attribute_methods
parent0215faf472aa22a0e57147cc529fe91ee3117926 (diff)
parent3e0c06d8ab1879539964c7b6c805eff870a80cbb (diff)
downloadrails-51157c9b46cb200b45554700dae3b4026f268b7f.tar.gz
rails-51157c9b46cb200b45554700dae3b4026f268b7f.tar.bz2
rails-51157c9b46cb200b45554700dae3b4026f268b7f.zip
Merge pull request #10567 from neerajdotname/read_attribute_before_type_cast_should_accept_symbol
read_attribute_before_type_cast should accept symbol
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/before_type_cast.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
index a23baeaced..f596a8b02e 100644
--- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
+++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb
@@ -41,8 +41,9 @@ module ActiveRecord
# task.read_attribute_before_type_cast('id') # => '1'
# task.read_attribute('completed_on') # => Sun, 21 Oct 2012
# task.read_attribute_before_type_cast('completed_on') # => "2012-10-21"
+ # task.read_attribute_before_type_cast(:completed_on) # => "2012-10-21"
def read_attribute_before_type_cast(attr_name)
- @attributes[attr_name]
+ @attributes[attr_name.to_s]
end
# Returns a hash of attributes before typecasting and deserialization.