On 6/2/07, Alexander Staubo <alex@xxxxxxxxxxxxxxx> wrote:
On 6/2/07, Martijn van Oosterhout <kleptog@xxxxxxxxx> wrote: > I don't know if it's a general problem, but I've been involved in a > using rails and it appears to have it's own way of declaring the > database. It presumes to handle referential integrity and uniqueness in > the application code (!). I think you've been misled. True, Rails/ActiveRecord does bear the signs of having been designed for MySQL/MyISAM, which has neither transactions nor referential integrity, but this does not mean that Rails does not support these constructs, or that Rails users don't use them. I value my data integrity, so all my relations have RI, unique constraints, null constraints, etc. as in any well-designed schema.
Rails propaganda explicitly proposes not "repeating yourself" and since the RI constraints are defined in the rails models, and they are enforced in the framework with a graceful feedback mechanism for users, they implicitly denigrate defining constraints in the DB as "Repeating yourself." The creator of RoR explicitly discourages use of RI, rules, triggers, etc in the database as unnecessary. His disciples take this as gospel. I have used rails for a couple projects and I repeated myself religiously in database constraints. This revealed a couple disturbing properties of rails that made me not want to use it, notably, assuming an empty input box equates to an empty string vice null for text data types, even if the table is defined as accepting nulls. - Ian