Dani Dani wrote in post #961802: > Colin Law wrote in post #961785: > >> As the readme for Foreigner at >> https://github.com/matthuhiggins/foreigner states: >> Foreigner introduces a few methods to your migrations for adding and >> removing foreign key constraints. >> >> Constraints being a key word here. It is for use in migrations, not >> in the app itself. >> >> Colin > > Ok, thank you, wasn't sure. > So there is no need for any plugin to support ActiveRecord regarding > foreign key use, e.g. make sure that all dependent records to be removed > from the database ? (sorry if it sounds too basics).
There is absolutely a need for the plugin. AR can enforce a certain amount of foreign key integrity in the application layer (including deleting dependent records), but enforcing it in he application layer is IMHO not really enforcing it at all: it only works insofar as the AR interface is the only way the DB is ever touched. And you really can't guarantee that in most cases. Therefore, it is absolutely essential to have foreign key constraints in the DB, which is what Foreigner manages for you. > > Thanks, > > Dani Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- 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.

