Skip to content

Commit

Permalink
Return nil from read_attribute if _foo is defined, but @attributes ha…
Browse files Browse the repository at this point in the history
…s no 'foo' key. Fixes breakage in test_find_only_some_columns on Ruby 1.9 which was introduced in a3639be.
  • Loading branch information
jonleighton committed Apr 15, 2011
1 parent ef95df7 commit 3609642
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/attribute_methods/read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def define_read_method(symbol, attr_name, column)
# "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 respond_to? "_#{attr_name}"
send "_#{attr_name}"
send "_#{attr_name}" if @attributes.has_key?(attr_name.to_s)
else
_read_attribute attr_name
end
Expand Down

0 comments on commit 3609642

Please sign in to comment.