diff options
author | Will Bryant <will.bryant@gmail.com> | 2008-09-24 16:44:56 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-29 17:49:44 +0200 |
commit | 8233f8314ba00838e8ef6b2d95cdfb7d58c8dece (patch) | |
tree | ca3cbb3d6c168f5d9dc705f2b5c973977de4080a /activerecord/test | |
parent | 8c105ee0c888a63cdbf593f0bfe688065b3e09e2 (diff) | |
download | rails-8233f8314ba00838e8ef6b2d95cdfb7d58c8dece.tar.gz rails-8233f8314ba00838e8ef6b2d95cdfb7d58c8dece.tar.bz2 rails-8233f8314ba00838e8ef6b2d95cdfb7d58c8dece.zip |
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>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index e78624a98d..3dd2cb028a 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -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 |