Why do Rails migrations define foreign keys in the application but not in the database?
Rails holds some conventions that enforcement of data integrity should be done in the application, not in the database. For example, Rails even supports some database designs that cannot use foreign keys, such as Polymorphic Associations. Basically, Rails conventions have treated the database as a static data storage device, not an active RDBMS. Rails 2.0 … Read more