diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-14 13:07:28 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-14 13:07:28 +0100 |
commit | 7963c30ebaeb511f7ddacc99ae2c7a530059ae6b (patch) | |
tree | 91e9811e1e18890cb8bb68fc28790bcbc2be42ad /activerecord/test/cases/associations | |
parent | bc821a56114ae6f6d0b595475ad9e71f01f46f35 (diff) | |
download | rails-7963c30ebaeb511f7ddacc99ae2c7a530059ae6b.tar.gz rails-7963c30ebaeb511f7ddacc99ae2c7a530059ae6b.tar.bz2 rails-7963c30ebaeb511f7ddacc99ae2c7a530059ae6b.zip |
Add test_has_many_through_has_many_through_with_belongs_to_source_reflection (which already works)
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/nested_has_many_through_associations_test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb index 26c31ef761..7e1fc60cb9 100644 --- a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb @@ -198,9 +198,20 @@ class NestedHasManyThroughAssociationsTest < ActiveRecord::TestCase assert_equal [comments(:greetings), comments(:more_greetings)], comments[2].category_post_comments end - # TODO: has_many through + # has_many through # Source: belongs_to # Through: has_many through + def test_has_many_through_has_many_through_with_belongs_to_source_reflection + author = authors(:david) + assert_equal [tags(:general), tags(:general)], author.tagging_tags + + authors = Author.joins(:tagging_tags).where('tags.id' => tags(:general).id) + assert_equal [authors(:david)], authors.uniq + + # TODO: Make this work + # authors = Author.includes(:tagging_tags) + # assert_equal [tags(:general), tags(:general)], authors.first.tagging_tags + end # TODO: has_many through # Source: has_many through |