mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
use underlying _read_attribute method rather than causing NoMethodErrors
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user