drnicwilliams.com— Ruby on Rails already made it easy to access databases whilst writing web applications. This extension reduces the amount of code that must be written to access data to almost zero.
Aug 7, 2006View in Crawl 4
Rails (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 :customersOf 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!
Pretty 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.
It'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!
trypnoticAug 8, 2006
Rails (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 :customersOf 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!
lukeredpathAug 8, 2006
Pretty 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.
ninjamalteAug 11, 2006
It'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!