diff options
author | Rick Olson <technoweenie@gmail.com> | 2008-03-26 15:40:57 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2008-03-26 15:40:57 +0000 |
commit | c366515abdecf750adfba574be89e8ec43c8553e (patch) | |
tree | 4fc55c98b920a7068572d79f3da5328ec6685628 /activerecord/test/cases | |
parent | 1648208ab09277467220efc92a532994024eea78 (diff) | |
download | rails-c366515abdecf750adfba574be89e8ec43c8553e.tar.gz rails-c366515abdecf750adfba574be89e8ec43c8553e.tar.bz2 rails-c366515abdecf750adfba574be89e8ec43c8553e.zip |
Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called. Closes #9407 [cavalle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/join_model_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 3d59b97f70..d4db4ef770 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -41,6 +41,14 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert_queries(1) { assert_equal 0, author.unique_categorized_posts.count(:title, :conditions => "title is NULL") } assert !authors(:mary).unique_categorized_posts.loaded? end + + def test_has_many_uniq_through_find + assert_equal 1, authors(:mary).unique_categorized_posts.find(:all).size + end + + def test_has_many_uniq_through_dynamic_find + assert_equal 1, authors(:mary).unique_categorized_posts.find_all_by_title("So I was thinking").size + end def test_polymorphic_has_many assert posts(:welcome).taggings.include?(taggings(:welcome_general)) |