-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dependent protect to belongs_to and has_one
Keep dependent protect option in reflection
- Loading branch information
Sergio
committed
Jul 1, 2009
1 parent
d3de3f6
commit c353529
Showing
2 changed files
with
53 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
= dependent => :protect option | ||
|
||
Adds a new option :protect for the parameter <tt>:depends</tt> from +has_many+ | ||
method. This option forbids destroying records with associated records in a | ||
association created with <tt>:dependent => :protect</tt> option, more or less | ||
like <tt>ON DELETE RESTRICT</tt> SQL statement. If you try to destroy a record with | ||
associated records it will raise a | ||
Adds a new option :protect for the parameter <tt>:depends</tt> from +has_many+, | ||
+has_one+ and +belongs_to+ methods. This option forbids destroying records with | ||
associated records in an association created with <tt>:dependent => :protect</tt> | ||
option, more or less like <tt>ON DELETE RESTRICT</tt> SQL statement. If you try | ||
to destroy a record with associated records it will raise an | ||
ActiveRecord::ReferentialIntegrityProtectionError (defined also in this | ||
plugin). | ||
|
||
Based on the idea and the code from [email protected] in Ruby on Rails | ||
ticket #3837 (http://dev.rubyonrails.org/ticket/3837). | ||
ticket #3837 (http://dev.rubyonrails.org/ticket/3837) and plugin from Daniel | ||
Rodríguez Troitiño <[email protected]> in | ||
http://svn.ruido-blanco.net/dependent_protect/ | ||
|
||
You can download this plugin at: | ||
|
||
http://svn.ruido-blanco.net/dependent_protect/trunk | ||
|
||
== Author | ||
|
||
Daniel Rodr�guez Troiti�o <[email protected]>, based on the ideas and | ||
the code from <[email protected]>. | ||
Sergio Cambra, based in a plugin from Daniel Rodríguez Troitiño | ||
<[email protected]>, and the ideas and the code from | ||
<[email protected]>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters