You don't need to write any of that code as long as you add the
scaffold directive to your controller or use the scaffold generator.
If you generated a blank controller, make sure you add
scaffold :somemodel inside the controller class. This is not needed if
you used the scaffold generator.
There has been talk about removing dynamic scaffolding, and I'm not
sure what the status is. The generator is still around, but as you
observed (and I did a couple of days ago), the behavior has changed.
Side note: For stuff that's not public-facing, it's surprising how
long scaffolded code can last I have an app that's been in
production since before Rails 1.0 and there's still some scaffold
code in it. Happy client because he got a great deal on the code I
didn't write.
Here's a search that may give you some insight into what Rails Core
is saying about scaffolding:
He's running on a pretty new version of Rails, and that provides, essentially, scaffold_resource from the generator. Please see http://dev.rubyonrails.org/changeset/7429 for the changeset that recommends using the scaffold generator.
No, it is current for rails 1.2 and as long as you are running the 1.2
version, scaffold will create all of the fields except for
relationships. It will do this for list, create, edit, etc. What
happens when you call that controller's new action:
I assume your controller is ProductsController and looks like this:
class ProductsController < ApplicationController
scafflod :product
end
I just tested this on rails 1.2.5 / ruby 1.8.6 and it works as it
always has. If it's still not working, is there anything in your logs?
Can you create a product from the console?
Ok, maybe this is a rails 2.0 thing, but I am running 1.2.6 (I said 1.2.5 earlier), and it still works fine for me? If you are running rails 2.0 edge, you should downgrade to 1.2.6 if you want to follow along with that book which is currently the latest book.