On Oct 24, 4:26 pm, nin_d <ninadpachp...@gmail.com> wrote:
> Fred, thanks! there s no user with id 1. My bad!
>
> While destroying a record, is there any easier way (a hook in
> activerecord) to get warning/error that record belongs to other
> records (if at all it does)?

You can set a dependent option on associations to control this sort of
stuff. If you want a real guarantee that this can't ever happen, use a
foreign key constraint.

Fred
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to