From 93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stian=20Gryt=C3=B8yr?= Date: Thu, 14 Apr 2011 16:31:08 +0200 Subject: Fixes performance issue introduced in 3.0.6 (issue #6695) --- activerecord/lib/active_record/attribute_methods/read.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (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 69d5cd83f1..43f736c89c 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -84,9 +84,11 @@ module ActiveRecord # Returns the value of the attribute identified by attr_name 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)). def read_attribute(attr_name) - send "_#{attr_name}" - rescue NoMethodError - _read_attribute attr_name + if respond_to? "_#{attr_name}" + send "_#{attr_name}" + else + _read_attribute attr_name + end end def _read_attribute(attr_name) -- cgit v1.2.3