aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorAditya Sanghi <aditya.sanghi@risingsuntech.net>2012-02-18 11:45:52 +0530
committerAditya Sanghi <aditya.sanghi@risingsuntech.net>2012-02-18 11:45:52 +0530
commitabcaa9be82277f96e7ddeaf4e32e6efb39edec02 (patch)
tree68d7ead9358b16d6eca7f12fdcc2abbc77914f34 /railties/guides/source
parent910f7aab50321b2a8b347864782d8dc4f09915d8 (diff)
downloadrails-abcaa9be82277f96e7ddeaf4e32e6efb39edec02.tar.gz
rails-abcaa9be82277f96e7ddeaf4e32e6efb39edec02.tar.bz2
rails-abcaa9be82277f96e7ddeaf4e32e6efb39edec02.zip
Add note about Rails 4.0 changes
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/association_basics.textile4
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile
index a01c24bf74..76bf9d10d4 100644
--- a/railties/guides/source/association_basics.textile
+++ b/railties/guides/source/association_basics.textile
@@ -901,6 +901,8 @@ h6(#has_one-dependent). +: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 +:nullify+, then deleting this object will set the foreign key in the association object to +NULL+.
If you set the +:dependent+ option to +:restrict+, then the deletion of the object is restricted if a dependent associated object exist and an error is added to the base model.
+NOTE: Before Rails 4.0, using +:restrict+ with +:dependent: option used to raise a +DeleteRestrictionError+. This functionality has since been deprecated. If your code still depends on the exception being raised, then you should add the +:config.active_record.dependent_restrict_raises = true+ to your application config.
+
h6(#has_one-foreign_key). +:foreign_key+
By convention, Rails assumes that the column used to hold the foreign key on the other model is the name of this model with the suffix +_id+ added. The +:foreign_key+ option lets you set the name of the foreign key directly:
@@ -1252,6 +1254,8 @@ If you set the +:dependent+ option to +:restrict+, then the deletion of the obje
NOTE: This option is ignored when you use the +:through+ option on the association.
+NOTE: Before Rails 4.0, using +:restrict+ with +:dependent: option used to raise a +DeleteRestrictionError+. This functionality has since been deprecated. If your code still depends on the exception being raised, then you should add the +:config.active_record.dependent_restrict_raises = true+ to your application config.
+
h6(#has_many-extend). +:extend+
The +:extend+ option specifies a named module to extend the association proxy. Association extensions are discussed in detail <a href="#association-extensions">later in this guide</a>.