Monday, April 11, 2011

Dynamic scaffolding in Rails 2.2.2

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?

From stackoverflow
  • 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.

0 comments:

Post a Comment