I am curious why the new scaffold generator doesn't include a
parameter for the model. As my friend Google and I have looked
around, we've found all sorts of pages claiming that 2.0 breaks all
the old tutorials because of this change (which it does), a lot of
pages showing how to work around this (which is trivial), but I have
yet to find an explanation for the rationale behind the change. The
closest I've found is a page that claimed that this is due to the new
RESTful routing mechanism and that with a RESTful application, the
model and the controller have the same name. That confused me even
more, since my understanding of REST is that the controller is the
"resource", not the model.
Anyway, I'm curious to understand why this change was made, and
whether there would be any benefit to submitting a patch adding the
capability to specify the model behind the controller when generating
a scaffold.
--wpd
HI --
I am curious why the new scaffold generator doesn't include a
parameter for the model. As my friend Google and I have looked
around, we've found all sorts of pages claiming that 2.0 breaks all
the old tutorials because of this change (which it does), a lot of
pages showing how to work around this (which is trivial), but I have
yet to find an explanation for the rationale behind the change. The
closest I've found is a page that claimed that this is due to the new
RESTful routing mechanism and that with a RESTful application, the
model and the controller have the same name. That confused me even
more, since my understanding of REST is that the controller is the
"resource", not the model.
Actually the resource is the resource
But you're right that the
controller is the Rails layer that maps most closely to it. In my
opinion it's very unfortunate that the term "resource" has become
almost synonymous in many people's minds with "controller-model stack
with a given name". The scaffodling, at the very least, strongly
reinforces this perception.
Anyway, I'm curious to understand why this change was made, and
whether there would be any benefit to submitting a patch adding the
capability to specify the model behind the controller when generating
a scaffold.
That would be a start. The ability not to generate a model at all
would also be a big step.
David