views:

745

answers:

1
class AdminController < ApplicationController
  scaffold :product
end

Above code works properly in Rails 1.2. But for the above mentioned code it gives error method missing 'scaffold' in Rails 2.2.2. Above code is used for dynamic scaffolding in Rails 1.2. Is this dynamic scaffolding supported in Rails 2.2.2?

or do I need to use ruby script/generate 'model_name' field_names to generate static scaffolding only, in Rails 2.2.2?

+1  A: 

Dynamic scaffolding has been deprecated. As you mentioned, you should just generate them using:

./script/generate scaffold

you can run that without any arguments to get the built-in help and syntax.

The reason I remember reading (it may have even been on this site) is that the scaffold is just a way to get started on building your application, the code that it generates should not be used for a production site. By having the scaffold generate the code for you to edit and suit your needs is much more flexible than having the code generated each time.

Dan McNevin