diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-05-05 15:30:21 -0500 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-05-05 15:30:21 -0500 |
commit | c91f4cc0f6461a05b9fed80b0519903930785767 (patch) | |
tree | cd98334d88577c28ecba8089f521c90aad79a7ec /activerecord | |
parent | ea3b88b1eff1d242da5e03ca3ae82f737c0cedbe (diff) | |
download | rails-c91f4cc0f6461a05b9fed80b0519903930785767.tar.gz rails-c91f4cc0f6461a05b9fed80b0519903930785767.tar.bz2 rails-c91f4cc0f6461a05b9fed80b0519903930785767.zip |
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]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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 |