Wrong number of arguments (Wrox Beginning Ruby On Rails)

I’m reading a book “Beginning Ruby on Rails”
I made an table, and tried to make an Model class. But it doesn’t
work.

I made the table as below.

mysql> show columns from books ;
±------------±-------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±------------±-------------±-----±----±--------±---------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(80) | NO | | NULL | |
| description | text | NO | | NULL | |
| price | decimal(8,0) | NO | | NULL | |
±------------±-------------±-----±----±--------±---------------+
4 rows in set (0.07 sec)

I typed to make an model class as below.

G:\web_apps\library>ruby script/generate scaffold Book Manage
exists app/models/
exists app/controllers/
exists app/helpers/
exists app/views/books
exists app/views/layouts/
exists test/functional/
exists test/unit/
exists test/unit/helpers/
exists public/stylesheets/
wrong number of arguments (1 for 2)

On 16 February 2010 11:54, seafront [email protected] wrote:

| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(80) | NO | | NULL | |
| description | text | NO | | NULL | |
| price | decimal(8,0) | NO | | NULL | |
±------------±-------------±-----±----±--------±---------------+
4 rows in set (0.07 sec)

I typed to make an model class as below.

G:\web_apps\library>ruby script/generate scaffold Book Manage

What is ‘Manage’ supposed to do?

You might be using an out of date tutorial, I suggest having a look at
the rails guide on Getting Started at http://guides.rubyonrails.org/.
This includes the use of scaffolding. Also work through the guides on
ActiveRecord Associations and Debugging, and most of the rest in fact.

Colin

Colin

The scaffold generator takes a model name, followed by an optional
space-delimited list of field name:type specs. So you might say:

script/generate scaffold Book name:string description:text
price:decimal

Or you can leave off the list of field names (in which case you don’t
get much in your views or the migration).

But the generator doesn’t know what to do with that trailing “Manage”.

Note that since you already have a table created, you’ll likely want to
delete the migration that the scaffold generator creates for you.

Also–bonus unsolicited advice: you’re best off using the exact version
of rails that your author specifies.

HTH,

-Roy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs