Preventing delete of parent with children

I’m lookin for an equilvalent to SQL ‘… on delete restrict’. To
prevent
deleting a parent record if there are related children records.
Looking at
the :dependent => options I see

:dependent => :destroy and :dependent => :nullify,
but not a :dependent => :restrict?

What is the best solution in this case?


Best Regards,
-Larry
“Work, work, work…there is no satisfactory alternative.”
— E.Taft Benson

On Jan 26, 2007, at 9:24 AM, Larry K. wrote:

Best Regards,
-Larry
“Work, work, work…there is no satisfactory alternative.”
— E.Taft Benson

Use a before_destroy callback on the parent?

http://rdoc.caboo.se/doc/classes/ActiveRecord/Callbacks.html#M005369

-Rob

Rob B. http://agileconsultingllc.com
[email protected]