From c366515abdecf750adfba574be89e8ec43c8553e Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 26 Mar 2008 15:40:57 +0000 Subject: 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 --- activerecord/test/cases/associations/join_model_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases/associations/join_model_test.rb') 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)) -- cgit v1.2.3