aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorStian Grytøyr <stian@grytoyr.net>2011-04-14 16:31:08 +0200
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-14 08:56:02 -0700
commit93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf (patch)
tree7615b1ff91e4d1c2cd5e7e68bf9e34b90dae5e4a /activerecord/lib/active_record/attribute_methods
parentfb6fa1e42507d1a2d7b7ba4b878763084e96f805 (diff)
downloadrails-93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf.tar.gz
rails-93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf.tar.bz2
rails-93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf.zip
Fixes performance issue introduced in 3.0.6 (issue #6695)
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/read.rb8
1 files changed, 5 insertions, 3 deletions
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 <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)).
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)