aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAditya Sanghi <asanghi@me.com>2011-05-22 04:47:04 -0700
committerAditya Sanghi <asanghi@me.com>2011-05-22 04:47:04 -0700
commite4f6e6ad2d00cf2a205a405c18b4c7f284d153fd (patch)
tree03e3ac328574e84250d737a33a4d2a1df46586b7 /activerecord/lib/active_record
parent023ca4fd4879f62107bcfb633d51eb57e3b6cfd7 (diff)
downloadrails-e4f6e6ad2d00cf2a205a405c18b4c7f284d153fd.tar.gz
rails-e4f6e6ad2d00cf2a205a405c18b4c7f284d153fd.tar.bz2
rails-e4f6e6ad2d00cf2a205a405c18b4c7f284d153fd.zip
has_many :dependent => :restrict raises an exception but is not documented appropriately. has_one also has :dependent => :restrict but is not documented at all.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index d1752a25ff..2116a94980 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1077,7 +1077,8 @@ module ActiveRecord
# alongside this object by calling their +destroy+ method. If set to <tt>:delete_all</tt> all associated
# objects are deleted *without* calling their +destroy+ method. If set to <tt>:nullify</tt> all associated
# objects' foreign keys are set to +NULL+ *without* calling their +save+ callbacks. If set to
- # <tt>:restrict</tt> this object cannot be deleted if it has any associated object.
+ # <tt>:restrict</tt> this object raises an <tt>ActiveRecord::DeleteRestrictionError</tt> exception and
+ # cannot be deleted if it has any associated objects.
#
# If using with the <tt>:through</tt> option, the association on the join model must be
# a +belongs_to+, and the records which get deleted are the join records, rather than
@@ -1226,7 +1227,8 @@ module ActiveRecord
# If set to <tt>:destroy</tt>, the associated object is destroyed when this object is. If set to
# <tt>:delete</tt>, the associated object is deleted *without* calling its destroy method.
# If set to <tt>:nullify</tt>, the associated object's foreign key is set to +NULL+.
- # Also, association is assigned.
+ # Also, association is assigned. If set to <tt>:restrict</tt> this object raises an
+ # <tt>ActiveRecord::DeleteRestrictionError</tt> exception and cannot be deleted if it has any associated object.
# [: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