aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/parrot.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-12-29 16:17:01 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-12-29 16:24:57 +0900
commit9abf606a79729833fd90f624ed580ad85f3ebadc (patch)
tree2ae13816024dd83168aadee998ace0505734dc65 /activerecord/test/models/parrot.rb
parent366f094598305074c4430fab581ddfd599c1cf96 (diff)
downloadrails-9abf606a79729833fd90f624ed580ad85f3ebadc.tar.gz
rails-9abf606a79729833fd90f624ed580ad85f3ebadc.tar.bz2
rails-9abf606a79729833fd90f624ed580ad85f3ebadc.zip
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.
Diffstat (limited to 'activerecord/test/models/parrot.rb')
-rw-r--r--activerecord/test/models/parrot.rb5
1 files changed, 5 insertions, 0 deletions
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