aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorErnie Miller <ernie@erniemiller.org>2013-01-11 09:42:15 -0500
committerErnie Miller <ernie@erniemiller.org>2013-01-11 10:32:36 -0500
commit18b9187b561639795279a5c9e1b6c2de8f1eab70 (patch)
treecb586345211d9965ee6410b1da1ffd43de493ea1 /activerecord
parent3211eb17b999523d19d7e5e4431e0f1ac25a740f (diff)
downloadrails-18b9187b561639795279a5c9e1b6c2de8f1eab70.tar.gz
rails-18b9187b561639795279a5c9e1b6c2de8f1eab70.tar.bz2
rails-18b9187b561639795279a5c9e1b6c2de8f1eab70.zip
Revert "Merge pull request #7661 from ernie/build-join-records-on-unsaved-hmt"
This reverts commit ee439895759b38431ad025f3c234831f30dadcdb. It would appear that #7661 had unintended consequences to the API. Until we can sort those out, this should not be in 3.2.x, and wait for 4.0.0.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb14
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb5
3 files changed, 6 insertions, 19 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index ec5fd2785a..9a782af58e 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,11 @@
## Rails 3.2.12 (unreleased) ##
+* Revert creation of through association models when using `collection=[]`
+ on a `has_many :through` association from an unsaved model.
+ Fix #7661, #8269.
+
+ *Ernie Miller*
+
* Fix undefined method `to_i` when calling `new` on a scope that uses an
Array; Fix FloatDomainError when setting integer column to NaN.
Fixes #8718, #8734, #8757.
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 ce81333aa9..53d49fef2e 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -38,20 +38,6 @@ module ActiveRecord
super
end
- def concat_records(records)
- ensure_not_nested
-
- records = super
-
- if owner.new_record? && records
- records.flatten.each do |record|
- build_through_record(record)
- end
- end
-
- records
- end
-
def insert_record(record, validate = true, raise = false)
ensure_not_nested
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index ffd7f4efa2..40d2e9568d 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -851,11 +851,6 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
end
end
- def test_assign_array_to_new_record_builds_join_records
- c = Category.new(:name => 'Fishing', :authors => [Author.first])
- assert_equal 1, c.categorizations.size
- end
-
def test_create_bang_should_raise_exception_when_join_record_has_errors
repair_validations(Categorization) do
Categorization.validate { |r| r.errors[:base] << 'Invalid Categorization' }