# Wrong number of arguments (Wrox Beginning Ruby On Rails)

**URL:** <https://www.ruby-forum.com/t/wrong-number-of-arguments-wrox-beginning-ruby-on-rails/183556>\
**Category:** Rails\
**Created:** [February 16, 2010, 2:31pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-wrox-beginning-ruby-on-rails/183556 "2010-02-16T14:31:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seafront](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@seafront](https://www.ruby-forum.com/u/seafront)\
**Post date:** [February 16, 2010, 2:31pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-wrox-beginning-ruby-on-rails/183556/1 "2010-02-16T14:31:33Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![seafront](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@seafront](https://www.ruby-forum.com/u/seafront)\
**Post date:** [February 16, 2010, 2:53pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-wrox-beginning-ruby-on-rails/183556/2 "2010-02-16T14:53:12Z")

</div>

On 16 February 2010 11:54, seafront [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](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

---

<div class="post-metadata">

**Author:** ![seafront](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@seafront](https://www.ruby-forum.com/u/seafront)\
**Post date:** [February 19, 2010, 5:59pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-wrox-beginning-ruby-on-rails/183556/3 "2010-02-19T17:59:15Z")

</div>

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
