I think a better question is, "Why isn't there a :dependent => :deny 
option?"

It's very common to have a relational dependency where you want to deny 
the deletion of an object that has related objects. It would be really 
nice if this referential integrity rule was part of Rails core rather 
than having to write it yourself or use a plugin.

It doesn't seem to me that it would be too difficult to add, if the 
count of the related objects is greater than zero deny the deletion.

Example:

Employee
  belongs_to :department

Department
  has_many :employees, :dependent => :deny

Deny deletion of a department if the department contains one or more 
employees.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to