Skip to content

Getting Started Old

Sergio Cambra edited this page Jan 9, 2025 · 4 revisions

Rails >= 4.0 (AS 3.5.x – 3.7.x)

Add the gem to your Gemfile:

gem 'active_scaffold'

And install with bundle install.

Then run rails g active_scaffold:install generator to add active_scaffold to your assets pipeline, and the concerns to the routes.rb file:

Use rails g active_scaffold:resource Model ... to generate model, migration, controller and routes, as rails g resource, or rails g active_scaffold:controller Controller to generate the controller and routes only.

Rails 3.1 and 3.2 (AS 3.2.x – 3.4.x)

Add the gem to your Gemfile:

gem 'active_scaffold'

And install with bundle install.

Then you need to add active_scaffold to your assets pipeline, by adding it as a comment at the bottom of the following two ‘manifests’ files:

In Rails.root/app/assets/stylesheets/application.css (or application.scss)

*= require active_scaffold

In Rails.root/app/assets/javascripts/application.js

//= require active_scaffold

Use rails g active_scaffold Model ... to generate model, migration, controller and routes, as rails g resource, or rails g active_scaffold_controller Controller to generate the controller and routes only.

Rails 3.0 and 2.3

For rails 3.0 use the gems version 3.0.23 and for rails 2.3.x rails use the second command (or third one if you need backwards compatibility)

gem install active_scaffold -v 3.0.23
./script/plugin install git://github.com/activescaffold/active_scaffold.git -r v2.4
./script/plugin install git://github.com/activescaffold/active_scaffold.git -r rails-2.3

Rails 2.3.x needs the plugin render_component for nested and embedded scaffolds

./script/plugin install git://github.com/ewildgoose/render_component.git -r rails-2.3

In rails 3.0 use rails g active_scaffold_setup (or rails g active_scaffold_setup jquery to use jquery instead of prototype) and it will download required js files to your public/javascript directory, update application layout and put a initializer to enable jquery in last case.

In rails 2.3.x use script/generate resource and create the layout by yourself, or use script/generate scaffold and remove generated controller code and the views.

Add this inside your layout:

<%= javascript_include_tag :defaults %>
<%= active_scaffold_includes %>

Add this inside the controller you want to run the scaffold:

active_scaffold :<your_model_name>

In rails 2.3, add :active_scaffold => true to your routes.rb file:

map.resources :<your_model_name>, :active_scaffold => true

In rails 3.0, you use as_routes in your routes.rb file instead:

resources :users do
  as_routes
end
Clone this wiki locally