aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorDavid Deller <david@horizon-nigh.org>2013-03-01 18:05:18 -0500
committerDavid Deller <david@horizon-nigh.org>2013-03-01 18:05:18 -0500
commitb7d50f352fc8918cc63dc6bb0f3e3d77fb7420cc (patch)
tree2744383fed699da5f1bb25f1503f1842baa9c724 /guides
parent3dde99d01c71dad36e483d0d1957639fde255c27 (diff)
downloadrails-b7d50f352fc8918cc63dc6bb0f3e3d77fb7420cc.tar.gz
rails-b7d50f352fc8918cc63dc6bb0f3e3d77fb7420cc.tar.bz2
rails-b7d50f352fc8918cc63dc6bb0f3e3d77fb7420cc.zip
Add explanation of :dependent => :restrict
Based on information here: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_many
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index dd59e2a8df..cb0a7c8026 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -845,7 +845,7 @@ Counter cache columns are added to the containing model's list of read-only attr
##### `:dependent`
-If you set the `:dependent` option to `:destroy`, then deleting this object will call the `destroy` method on the associated object to delete that object. If you set the `:dependent` option to `:delete`, then deleting this object will delete the associated object _without_ calling its `destroy` method.
+If you set the `:dependent` option to `:destroy`, then deleting this object will call the `destroy` method on the associated object to delete that object. If you set the `:dependent` option to `:delete`, then deleting this object will delete the associated object _without_ calling its `destroy` method. If you set the `:dependent` option to `:restrict`, then attempting to delete this object will result in a `ActiveRecord::DeleteRestrictionError` if there are any associated objects.
WARNING: You should not specify this option on a `belongs_to` association that is connected with a `has_many` association on the other class. Doing so can lead to orphaned records in your database.