From 9abf606a79729833fd90f624ed580ad85f3ebadc Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Dec 2016 16:17:01 +0900 Subject: Should not update children when the parent creation with no reason This issue was introduced with d849f42 to solve #19782. However, we can solve #19782 without causing the issue. It is enough to save only when necessary. Fixes #27338. --- activerecord/test/models/parrot.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/parrot.rb b/activerecord/test/models/parrot.rb index 5b693664d4..1e5f9285a8 100644 --- a/activerecord/test/models/parrot.rb +++ b/activerecord/test/models/parrot.rb @@ -13,6 +13,11 @@ class Parrot < ActiveRecord::Base def cancel_save_callback_method throw(:abort) end + + before_update :increment_updated_count + def increment_updated_count + self.updated_count += 1 + end end class LiveParrot < Parrot -- cgit v1.2.3