Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Merge pull request #7661 from ernie/build-join-records-on-uns…

…aved-hmt"

This reverts commit ee43989.

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.
  • Loading branch information...
commit 18b9187b561639795279a5c9e1b6c2de8f1eab70 1 parent 3211eb1
@ernie ernie authored
View
6 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.
View
14 activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -38,20 +38,6 @@ def concat(*records)
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
View
5 activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -851,11 +851,6 @@ def test_save_should_not_raise_exception_when_join_record_has_errors
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' }
Please sign in to comment.
Something went wrong with that request. Please try again.