On Mon, November 28, 2011 09:15, Rodrigo Rosenfeld Rosas wrote: > Is there any reason why AR has never supported foreign-key > constraints? >
Historically, RoR as opinionated software, viewed the backing store as a bit-bucket and little else. The AR Model was to provide the business logic. Database level functions beyond store and retrieval were considered superfluous in most respects. To put it bluntly, DHH was not a DBA type of guy. So, for example, things like primary key enforcement was expected to be done through validations rather than through the DBMS itself (with the predictable negative experiences resulting from race conditions). Mostly, DBMS generated errors were left to each application to handle idiosyncratically rather than integrated into RoR's AR validations scheme. No doubt the effort required to handle the multitude of errors generated by various DBMS adapters was considered to be significantly greater than any benefits thereby obtained for most RoR projects. In any case, people that felt the need for such things had other ways to provide them. RoR did not prevent using the DBMS to manage consistency, it just did not make it as easy to do as it did for other things. Foreign key support for migrations was/is available only through third-party extensions such as Red Hill plugin and the Foreigner gem. But, such support was available from a very early stage in RoR. -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:byrn...@harte-lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.