3 ms·
Isn't Rails getting real foreign keys only in yet to release 4.2?
by manojlds 12y ago
Isn't Rails getting real foreign keys only in yet to release 4.2?
- SEMW 12y agoNot using proper foreign keys doesn't mean you can't have associations, it just means that the database won't enforce their integrity. (If you wanted that enforcement in rails, the traditional solution was the Foreigner gem[0]). (My guess is Rails didn't use proper FKs by default because the default development db (SQLite) originally didn't support foreign keys (though it has for a while now, since 3.9.16), and they presumably wanted to minimise the differences in the way they use different databases). [0] https://github.com/matthuhiggins/foreigner https://github.com/matthuhiggins/foreigner