Dr. Nic’s Magic Models
View blog reactions Written on April 24, 2007 by Chris Heald
One of the annoying things about Rails is that it goes so far to connect pieces of the database together for you, but it doesn’t have the ability to automatically do validations or associations based on the schema data. A VARCHAR(30) NOT NULL is always going to need validates_length_of(:field, :in => 0..30), and validates_presence_of(:field), right? Or if you define a foreign key on a table, that’s an implied association that you’d have to set up in your model.
Dr. Nic’s Magic Models provide just that. Based on the DB schema, the models will get automatic validations and associations, which I suspect would reduce the amount of code you have to write, and would result in both more complete Ruby code and better DB schemas.
Posted in 