Skip to content

Commit

Permalink
Fixes performance issue introduced in 3.0.6 (issue rails#6695)
Browse files Browse the repository at this point in the history
  • Loading branch information
stiang authored and tenderlove committed Apr 14, 2011
1 parent 3d15019 commit a3639be
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions activerecord/lib/active_record/attribute_methods/read.rb
Expand Up @@ -77,9 +77,11 @@ def define_read_method(symbol, attr_name, column)
# 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)
Expand Down

0 comments on commit a3639be

Please sign in to comment.