use underlying _read_attribute method rather than causing NoMethodErrors

This commit is contained in:
Aaron Patterson
2011-01-11 15:39:26 -08:00
parent 5696d948ed
commit fcd8925f23
2 changed files with 2 additions and 2 deletions

View File

@@ -1578,7 +1578,7 @@ MSG
# Returns true if the specified +attribute+ has been set by the user or by a database load and is neither
# nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings).
def attribute_present?(attribute)
!read_attribute(attribute).blank?
!_read_attribute(attribute).blank?
end
# Returns the column object for the named attribute.

View File

@@ -523,7 +523,7 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase
def test_has_many_through_collection_size_uses_counter_cache_if_it_exists
author = authors(:david)
author.stubs(:read_attribute).with('comments_count').returns(100)
author.stubs(:_read_attribute).with('comments_count').returns(100)
assert_equal 100, author.comments.size
assert !author.comments.loaded?
end