On Jan 20, 2008 6:46 PM, Ryan B. [email protected] wrote:
But surely there was a reason why scaffolding was taken out of Rails. They
didn’t just put all the features on slips of paper and draw them out of a
hat. Scaffolding is a good start, but you end up changing more than 50% of
the code afterwards. Do you really think it’s use should be encouraged
still? Default scaffolding, as far as I know, does not follow REST
conventions, although there is a scaffold_resource which could be used, but
again you’ll end up changing most of that code.
Before the pre-2.0 rails edge became rails edge, script/generate
scaffold_resource went away as a command, and took over
script/generate scaffold, all Rails 2.0 scaffolds are RESTful now.
Actually in my experience, scaffolding is MORE useful in Rails 2.0
than it was in earlier versions.
Prior to 2.0 I never used scaffolding other than in following the
tutorials. After I got my feed wet I tended to just code stuff by
hand.
In Rails 2.0 I’ve been using script/generate scaffold a lot. There
are several reasons.
With dynamic scaffolding, you’ve got nothing to work with when you
want to go beyond basic CRUD forms and displays. Sure it’s nice that
you can add fields to models and don’t have to change (the
non-existant) views, but it never seemed worth it to me.
The Rails 2.0 scaffold generation, along with restful design is
actually much more powerful in getting started.
You get the seven standard controller actions
You get useful tests (well I think you do, you certainly get
useful specs if you use the rspec_scaffold verion)
You get the migration as well and can specify initial attributes
for your model.
The downside of course is that it just gets you started and you need
to manually maintain views as you migrate your models, but it gets you
started on a much better path than relying on the old “magical”
dynamic scaffolding.
In my spare time, I’ve started writing a parallel to the depot app in
AWDWR 2nd ed, which uses generated scaffolding and a RESTful design.
So far I’ve managed to find about a half a day to work on it and have
gotten through some comments on the rails installation and setup
chapter and most of the first chapter on the depot app, and have
written about 20 pages.
For better or worse though, this has to take a lower priority than
billable work, so I can only work on it sporadically. No promises on
when I might get it to the point where I’d be willing to embarrass
myself by making it public.
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/