From facfc24f256d8367f33a62e3bbea6c0f8c698c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 8 Jul 2013 16:47:00 -0300 Subject: Preparing for 3.2.14.rc1 release --- activerecord/CHANGELOG.md | 2 +- activerecord/lib/active_record/version.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 88f69a7308..37adce4f30 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,4 @@ -## unreleased ## +## Rails 3.2.14.rc1 (Jul 8, 2013) ## * Do not shallow the original exception in `exec_cache` on PostgreSQL adapter. diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb index 9069d9964f..b220f08663 100644 --- a/activerecord/lib/active_record/version.rb +++ b/activerecord/lib/active_record/version.rb @@ -2,8 +2,8 @@ module ActiveRecord module VERSION #:nodoc: MAJOR = 3 MINOR = 2 - TINY = 13 - PRE = nil + TINY = 14 + PRE = "rc1" STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') end -- cgit v1.2.3 From 2ae2728d78298030b1015497840b0519b5ed21a1 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 15 Jul 2013 11:17:25 -0700 Subject: Merge pull request #11451 from jetthoughts/11450_do_not_resave_destroyed_association Do not re-save destroyed association on saving parent object Conflicts: activerecord/lib/active_record/autosave_association.rb --- activerecord/CHANGELOG.md | 9 +++++++++ activerecord/lib/active_record/autosave_association.rb | 2 ++ activerecord/test/cases/autosave_association_test.rb | 7 +++++++ 3 files changed, 18 insertions(+) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 37adce4f30..59f670dd4a 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,12 @@ +## Rails 3.2.14.rc2 (unreleased) ## + +* Do not re-create destroyed association when saving the parent object. + + Fixes #11450. + + *Paul Nikitochkin* + + ## Rails 3.2.14.rc1 (Jul 8, 2013) ## * Do not shallow the original exception in `exec_cache` on PostgreSQL adapter. diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 3fc9d307bc..4da39299f0 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -339,6 +339,8 @@ module ActiveRecord end records.each do |record| + next if record.destroyed? + saved = true if autosave != false && (@new_record_before_save || record.new_record?) diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 6dbc419eb5..5556ab8fcc 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -734,6 +734,13 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase ids.each { |id| assert_nil klass.find_by_id(id) } end + def test_should_not_resave_destroyed_association + @pirate.birds.create!(name: :parrot) + @pirate.birds.first.destroy + @pirate.save! + assert @pirate.reload.birds.empty? + end + def test_should_skip_validation_on_has_many_if_marked_for_destruction 2.times { |i| @pirate.birds.create!(:name => "birds_#{i}") } -- cgit v1.2.3 From 1900a56669ba1fc6776fe64534ff1f45104e343c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 15 Jul 2013 17:44:49 -0300 Subject: Use Ruby 1.8 syntax --- activerecord/test/cases/autosave_association_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 5556ab8fcc..cb68f96412 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -735,7 +735,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase end def test_should_not_resave_destroyed_association - @pirate.birds.create!(name: :parrot) + @pirate.birds.create!(:name => :parrot) @pirate.birds.first.destroy @pirate.save! assert @pirate.reload.birds.empty? -- cgit v1.2.3 From a96df04aac00fb2b7d91978c24741100230a50d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 16 Jul 2013 13:00:33 -0300 Subject: Preparing for 3.2.14.rc2 release --- activerecord/CHANGELOG.md | 4 ++-- activerecord/lib/active_record/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 59f670dd4a..6e88e4614a 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,4 @@ -## Rails 3.2.14.rc2 (unreleased) ## +## Rails 3.2.14.rc2 (Jun 16, 2013) ## * Do not re-create destroyed association when saving the parent object. @@ -7,7 +7,7 @@ *Paul Nikitochkin* -## Rails 3.2.14.rc1 (Jul 8, 2013) ## +## Rails 3.2.14.rc1 (Jul 12, 2013) ## * Do not shallow the original exception in `exec_cache` on PostgreSQL adapter. diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb index b220f08663..d6dbb0b74d 100644 --- a/activerecord/lib/active_record/version.rb +++ b/activerecord/lib/active_record/version.rb @@ -3,7 +3,7 @@ module ActiveRecord MAJOR = 3 MINOR = 2 TINY = 14 - PRE = "rc1" + PRE = "rc2" STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') end -- cgit v1.2.3 From 47fb44fc7a12f6a57b71b6dcd68a19e572101703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 22 Jul 2013 11:57:02 -0300 Subject: Update CHANGELOG entry --- activerecord/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 6e88e4614a..608e10f866 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,4 @@ -## Rails 3.2.14.rc2 (Jun 16, 2013) ## +## Rails 3.2.14 (Jul 22, 2013) ## * Do not re-create destroyed association when saving the parent object. @@ -6,9 +6,6 @@ *Paul Nikitochkin* - -## Rails 3.2.14.rc1 (Jul 12, 2013) ## - * Do not shallow the original exception in `exec_cache` on PostgreSQL adapter. Fixes #11260. -- cgit v1.2.3 From 2fcd13eff251ca9e1ff5cf6a13f72c18087daf60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 22 Jul 2013 12:05:41 -0300 Subject: Preparing for 3.2.14 release --- activerecord/lib/active_record/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb index d6dbb0b74d..9e3d1539c6 100644 --- a/activerecord/lib/active_record/version.rb +++ b/activerecord/lib/active_record/version.rb @@ -3,7 +3,7 @@ module ActiveRecord MAJOR = 3 MINOR = 2 TINY = 14 - PRE = "rc2" + PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') end -- cgit v1.2.3