From 7c38da9647bce861b41233d16dfc1d43553ec4af Mon Sep 17 00:00:00 2001 From: Henry Hsu Date: Sat, 26 Sep 2009 01:53:09 -0700 Subject: [PATCH] LH2982 - eager loading of a :uniq => true HABTM association, returns duplicate entries, failing test on master --- .../has_and_belongs_to_many_associations_test.rb | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index 11a1596..db61c55 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -323,6 +323,21 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase assert_equal 3, project.developers.size end + def test_uniq_option_with_eager_loading + project = projects(:active_record) + project_id = project.id + dev_3 = developers(:dev_3) + + assert_equal 3, project.developers.size + 5.times do + project.developers << dev_3 + end + assert_equal 4, project.developers.size + + project = Project.find(project.id, :include => [:developers]) + assert_equal 4, project.developers.size + end + def test_deleting david = Developer.find(1) active_record = Project.find(1) -- 1.6.4.2