aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2015-02-01 18:31:47 +0000
committerAbdelkader Boudih <terminale@gmail.com>2015-02-01 18:31:47 +0000
commit2fe954ec803efe6b8f3b08541070f9e6a8c71232 (patch)
treeecb2e577be82c98e2c36eebb54b27b2827efa484
parent0f2e05d64f9539940b1eb926d67d911c9554f85a (diff)
parentec48e5d6543b4c14f5dd86b6815ce4a30a572d06 (diff)
downloadrails-2fe954ec803efe6b8f3b08541070f9e6a8c71232.tar.gz
rails-2fe954ec803efe6b8f3b08541070f9e6a8c71232.tar.bz2
rails-2fe954ec803efe6b8f3b08541070f9e6a8c71232.zip
Merge pull request #18770 from palkan/docs-hasone-dependent
Add note about has_one :through and :dependent
-rw-r--r--activerecord/lib/active_record/associations.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 35bc09bb10..81a42e22f3 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1000,6 +1000,8 @@ module ActiveRecord
# callbacks declared either before or after the <tt>:dependent</tt> option
# can affect what it does.
#
+ # Note that <tt>:dependent</tt> option is ignored for +has_one+ <tt>:through</tt> associations.
+ #
# === Delete or destroy?
#
# +has_many+ and +has_and_belongs_to_many+ associations have the methods <tt>destroy</tt>,
@@ -1330,6 +1332,8 @@ module ActiveRecord
# * <tt>:nullify</tt> causes the foreign key to be set to +NULL+. Callbacks are not executed.
# * <tt>:restrict_with_exception</tt> causes an exception to be raised if there is an associated record
# * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there is an associated object
+ #
+ # Note that <tt>:dependent</tt> option is ignored when using <tt>:through</tt> option.
# [:foreign_key]
# Specify the foreign key used for the association. By default this is guessed to be the name
# of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_one+ association