From bcf89f44e0597b0ef8886d5d82be12c51462793c Mon Sep 17 00:00:00 2001 From: Yves Siegrist Date: Mon, 7 Dec 2015 14:06:00 +0100 Subject: Typo correction In the doc the `dependent` option was set with: `dependent: destroy`. This is not working because destroy would call the method of the activerecord::base object. The right way is: `dependent: :destroy` --- activerecord/lib/active_record/callbacks.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index cfd8cbda67..4058affec3 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -208,12 +208,12 @@ module ActiveRecord # # Sometimes the code needs that the callbacks execute in a specific order. For example, a +before_destroy+ # callback (+log_children+ in this case) should be executed before the children get destroyed by the - # dependent: destroy option. + # dependent: :destroy option. # # Let's look at the code below: # # class Topic < ActiveRecord::Base - # has_many :children, dependent: destroy + # has_many :children, dependent: :destroy # # before_destroy :log_children # @@ -228,7 +228,7 @@ module ActiveRecord # You can use the +prepend+ option on the +before_destroy+ callback to avoid this. # # class Topic < ActiveRecord::Base - # has_many :children, dependent: destroy + # has_many :children, dependent: :destroy # # before_destroy :log_children, prepend: true # @@ -238,7 +238,7 @@ module ActiveRecord # end # end # - # This way, the +before_destroy+ gets executed before the dependent: destroy is called, and the data is still available. + # This way, the +before_destroy+ gets executed before the dependent: :destroy is called, and the data is still available. # # == \Transactions # -- cgit v1.2.3