Help in executing the following command

when i run the line

ruby script/generate scaffold Item Manage

it displays:
wrong number of arguments(1 for 2)

i am consulting book “biggining Ruby on Rails” pg 167
where controler and model are created together.
kindly give your suggestion.

As far as I know, the boot you’re reading is based on Rails 1.2. If
your installation is Rails 2.x the scaffold generator will be
different. With the scaffold generator now, you can create a scaffold
for a model, the controller will get the default name (pluralize of
the model). You can add the column names to your scaffold command
directly. So

ruby script/generate scaffold Item name:string price:decimal
description:text

will generate a model Item, a database table “items” with the columns
name, price and description, a controller “ItemsController” containing
the basic CRUD actions and the views for the CRUD actions. Plus the
route “map.resources items” that lets you access all the actions of
the controller.

Note that using the scaffold generator is usually only done to quickly
start doing stuff in your application and you will always want to
change the default templates and actions for a real life application.
You can always change the name of controller to “Manage” for
separating the admin-only actions (for managing Items) from user-only
actions (for displaying, searching and buying Items for example).
That’s hand work and if you do that, you will be rewarded with
learning how Rails routing works :slight_smile:

Good luck!

Dirk.

also, you can drop the capital letter in item:

ruby scrip/generate item (always always singular!!)