mirror of
https://github.com/github/rails.git
synced 2026-02-03 18:55:29 -05:00
wrote a test showing eager loading's misbehavior (sanitizing against the wrong table) when the association has a :conditions hash
Signed-off-by: Michael Koziarski <michael@koziarski.com>
This commit is contained in:
committed by
Michael Koziarski
parent
8c105ee0c8
commit
8233f8314b
@@ -116,6 +116,13 @@ class EagerAssociationTest < ActiveRecord::TestCase
|
||||
assert_equal 2, posts.first.comments.size
|
||||
end
|
||||
|
||||
def test_loading_from_an_association_that_has_a_hash_of_conditions
|
||||
assert_nothing_raised do
|
||||
Author.find(:all, :include => :hello_posts_with_hash_conditions)
|
||||
end
|
||||
assert !Author.find(authors(:david).id, :include => :hello_posts_with_hash_conditions).hello_posts.empty?
|
||||
end
|
||||
|
||||
def test_loading_with_no_associations
|
||||
assert_nil Post.find(posts(:authorless).id, :include => :author).author
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user