Using database constraints

Do you think it’s necessary to use database constraints like foreign
keys or it is safe to use only rails constraints like has_many and so
on.

Msan M. wrote:

Do you think it’s necessary to use database constraints like foreign
keys or it is safe to use only rails constraints like has_many and so
on.

It’s absolutely necessary to use foreign key constraints – has_many and
things like that aren’t really constraints, and anyway, they only come
into play if the DB is modified through the ActiveRecord interface. To
keep your data safe, you must use foreign key constraints. Use the
Foreigner plugin to manage these constraints easily from migrations.

Search the list archives for more info.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

There is also foreigner gem, version 0.9.0.
Is it better to use the plugin or the gem?

Please quote when replying

Msan M. wrote:

There is also foreigner gem, version 0.9.0.
Is it better to use the plugin or the gem?

Most likely the gem. When I said “plugin” I meant “plugin or
plugin-type gem”.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]