Problem
You want to use ActiveScaffold in Rails 2.2, in a model that you have created using the standard Rails scaffolding script.
Solution
- Install the ActiveScaffold plugin:
1script/plugin install git://github.com/activescaffold/active_scaffold.git -r rails-2.2 - In your layout (model or application for all models) add the following:
12<%= javascript_include_tag :defaults %><%= active_scaffold_includes %> - In your controller file delete all the standard scaffolding code and add one line, so that your new controller should look like:
123class SomethingsController < ApplicationControlleractive_scaffold :somethingend - To configure a RESTful scaffold add the following to your route.rb file:
1map.resources :somethings, :active_scaffold => true - Delete the views that were created from the standard rails scaffolding in the views/somethings folder (edit, show, index …)
- Restart your server
You should now have an active scaffold for your model.