From e96d04a2e4e244ea5053cb4e8ab97db604d0c796 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 27 Mar 2012 11:27:51 -0700 Subject: attributes are cached by string keys, so to_s to support symbols. fixes #5549 --- activerecord/lib/active_record/attribute_methods/read.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 846ac03d82..37f440b44f 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -118,7 +118,7 @@ module ActiveRecord # "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)). def read_attribute(attr_name) # If it's cached, just return it - @attributes_cache.fetch(attr_name) { |name| + @attributes_cache.fetch(attr_name.to_s) { |name| column = @columns_hash.fetch(name) { return self.class.type_cast_attribute(name, @attributes, @attributes_cache) } -- cgit v1.2.3