Neal L wrote:
> This is a total noob question, but how do you prevent a record from
> being destroyed if it has any related records.

The database layer can do this easily, so harness its power!  Put a 
foreign key constraint in your DB with ON DELETE RESTRICT.  The Railsy 
way to do this is with the excellent foreign_key_migrations plugin (see 
http://github.com/harukizaemon ) -- which you should probably be using 
in any case.  It works with mySQL and PostgreSQL; I'm not sure about 
other database systems.

Best,
--
Marnen Laibow-Koser
[email protected]
http://www.marnen.org
-- 
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