Sponsored by Norton 2010
Cybercrime makes more money than illegal drugs. view!
everyclickmatters.com - See the top masterminds behind the biggest cyberscams ever—and what they cost us all.
5 Comments
- trypnotic, on 10/12/2007, -0/+1Rails (via ActiveRecord) already has good database introspection, but this turns it up a few notches. In the DRY (Don't repeat yourself) tradition, this creates models for you and also relieves you from having to write standard relationships like:
has_many :customers
Of course, if you have more complex relationships you can still write them. I imagine that this would be handy for Railifying a legacy database with lots of tables. Dugg! - ninjamalte, on 10/12/2007, -0/+0It's about not repeating yourself. Why would you want to specify the same information in two places (in the db scheme and in the model, as it is now)?
These magic models should be a part of vanilla rails IMHO; it's definitely that good an idea! - lukeredpath, on 10/12/2007, -0/+0Pretty nifty; a cool piece of hackery (I mean that in a good way); but ultimately pointless IMO.
Yes, its good to keep things DRY and keep your constraints and associations in one place and in the name of expressive, declrative programming I’d much rather keep them in the model where they belong and use my database as a dumb data store.
Why would I want to view the schema every time I want to know about my model’s constraints and associations?
Finally, as cool as the models without classes trick is, what use is it really? You’re still gonna need the model file unless you’re happy with an anaemic domain model. - nicwilliams, on 10/12/2007, -1/+0As long as I'm using the right fad for the job :)
- insomniac8400, on 10/12/2007, -1/+0Sigh, fads come and go, but microsoft never dies.


What is Digg?
The Digg Toolbar for Firefox lets you Digg, submit content, and keep track of Digg even when you're not on the Digg site. Download the official