From: David Heinemeier Hansson Date: 2005-10-28T06:46:36+09:00 Subject: Re: Ruby on Rails version of osCommerce in PHP? > Yeah. I'm a cheerleader for foreign keys and hate that my embedded > database of choice (sqlite) doesn't support them in any way. There are > times when business constraints can be useful -- but the "proper" way of > doing that would actually be to abstract the relational information one > level further (e.g., if something can only be 'y' or 'n', then there > should be a *table* with a FK that contains the 'y' and 'n' values). On the notion of foreign keys, let this serve as an open invitation to anyone that wants to implement support for dumping and migrating those through the facilities in Active Record. We don't currently support them at all. It would be nice to do that. > I will argue for the pushing of business logic into the database when > you hit an integration database stage or possibly access the data > through multiple mechanisms (perhaps in different languages) just so > that you don't violate DRY. I totally agree. But I would be on the barricades to guard such a move in the first place. There are so many other ways of integrating applications and data that doesn't involve sidestepping the domain model. But if you're forced to do it, you basically need every logic trick in the book to keep you DRY and safe. > But by and large, most people put too much business logic in the > database. Hear, hear ;). Objects, baby. That's where its at. -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework