odie’s webmemory

Generate a model and a controller vs a scaffold

November 14, 2006 · 1 Comment

What do you get when you generate a scaffold instead of generating the model and the controller individually? Below are the excerpts (i.e., edited results) when I ran the generators with the -p option (pretend).

ruby script/generate model entry -p
create app/models/entry.rb
create db/migrate/001_create_entries.rb

ruby script/generate controller entry -p
create app/controller/entry_controller.rb

ruby script/generate scaffold entry entry -p
create app/models/entry.rb
create app/views/entry/_form.rhtml
create app/views/entry/list.rhtml
create app/views/entry/show.rhtml
create app/views/entry/new.rhtml
create app/views/entry/edit.rhtml
create app/controllers/entry_controller.rb
create app/views/layouts/entry.rhtml
create public/stylesheets/scaffold.css

Notes:

  1. The model generator creates a migration file.
  2. The scaffold generator creates actions, views, a layout and a stylesheet.

Categories: rubyonrails