Number one tip is to use the help from rails itself:
script/generate scaffold -h
In rails 1.x, I created model and table in db firstly then do the scaffold, now the generator can do the model and table in the same time. The way to keep your old habit is to use:
> script/generate scaffold category(or other model name) --skip-migration
In the views, I need add the _form.html.erb by myself.
The generator will also put a map.resources in your routes.rb. If I want to add new actions such as batch_new and batch_create into this categories_controller. Config the routes.rb:
map.resources :categories,
:collection => {:batch_new => :get, :batch_create => :post}
1 comment:
It seems that it implements REST with default scaffold replacing the old scaffold_resource
Post a Comment