From c91f4cc0f6461a05b9fed80b0519903930785767 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 5 May 2016 15:30:21 -0500 Subject: Change to use a more realistic example and not giving the impression that destroy_all is preferred way to destroy related records. This example just wants to demonstrate callback behaviour. [ci skip] --- activerecord/lib/active_record/callbacks.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/callbacks.rb') diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 5d4d9379f0..95de6937af 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -53,9 +53,9 @@ module ActiveRecord # end # # class Firm < ActiveRecord::Base - # # Destroys the associated clients and people when the firm is destroyed - # before_destroy { |record| Person.where(firm_id: record.id).destroy_all } - # before_destroy { |record| Client.where(client_of: record.id).destroy_all } + # # Disables access to the system, for associated clients and people when the firm is destroyed + # before_destroy { |record| Person.where(firm_id: record.id).update_all(access: 'disabled') } + # before_destroy { |record| Client.where(client_of: record.id).update_all(access: 'disabled') } # end # # == Inheritable callback queues -- cgit v1.2.3