Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To your first question, Rails tried to enforce some constraints at the application level, but it was lacking. I worked in a large production system and for extra safeguards their were DB level foreign key constraints. They are kind of a pain to unwind and make changes, but they can save your butt if you accidentally delete something.

Second question: You can see this answer: http://stackoverflow.com/questions/507179/does-foreign-key-i...



Read more about the shortcomings of application level reference validations here: http://robots.thoughtbot.com/referential-integrity-with-fore...

Note: that post talks about using `foreigner` gem which predates having foreign key support in rails core.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: