From 22c4dbc29c451a8066196b1e3bf992121beb758d Mon Sep 17 00:00:00 2001 From: Paul Bowsher Date: Sat, 16 Oct 2010 12:28:47 +0100 Subject: [PATCH] Don't manually push join record onto the join collection in hmt [#5823 state:resolved] --- .../associations/has_many_through_association.rb | 1 - .../test/cases/associations/join_model_test.rb | 2 ++ 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 97883d8..3e1bb9a 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -69,7 +69,6 @@ module ActiveRecord through_association = @owner.send(@reflection.through_reflection.name) through_record = through_association.create!(construct_join_attributes(record)) - through_association.proxy_target << through_record end # TODO - add dependent option support diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 7a22ce4..04cda07 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -485,6 +485,8 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase message = "Expected a Tagging in taggings collection, got #{wrong.class}.") assert_equal(count + 1, post_thinking.tags.size) assert_equal(count + 1, post_thinking.tags(true).size) + assert_equal(count + 1, post_thinking.taggings.size) + assert_equal(count + 1, post_thinking.taggings(true).size) assert_kind_of Tag, post_thinking.tags.create!(:name => 'foo') assert_nil( wrong = post_thinking.tags.detect { |t| t.class != Tag }, -- 1.7.2.2