aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/callbacks.rb
diff options
context:
space:
mode:
authorYves Siegrist <Elektron1c97@gmail.com>2015-12-07 14:06:00 +0100
committerYves Siegrist <Elektron1c97@gmail.com>2015-12-07 14:06:00 +0100
commitbcf89f44e0597b0ef8886d5d82be12c51462793c (patch)
tree5ee6201adacadd110259ed5bd9ff0c73e6c791d4 /activerecord/lib/active_record/callbacks.rb
parent6bd417df5075f1006557f6d9e44b5a9637015c70 (diff)
downloadrails-bcf89f44e0597b0ef8886d5d82be12c51462793c.tar.gz
rails-bcf89f44e0597b0ef8886d5d82be12c51462793c.tar.bz2
rails-bcf89f44e0597b0ef8886d5d82be12c51462793c.zip
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`
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r--activerecord/lib/active_record/callbacks.rb8
1 files changed, 4 insertions, 4 deletions
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
- # <tt>dependent: destroy</tt> option.
+ # <tt>dependent: :destroy</tt> 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 <tt>dependent: destroy</tt> is called, and the data is still available.
+ # This way, the +before_destroy+ gets executed before the <tt>dependent: :destroy</tt> is called, and the data is still available.
#
# == \Transactions
#