# Newbie question: scaffold not working

**URL:** <https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220>\
**Category:** Rails\
**Created:** [August 13, 2006, 4:13am UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220 "2006-08-13T04:13:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 13, 2006, 4:13am UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/1 "2006-08-13T04:13:53Z")

</div>

I went through a tutorial at  
[Radar – O’Reilly](http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=1) to get  
started with RoR. I really like the idea of the scaffold construct, but  
I can’t seem to get it to work the way it was described in the tutorial.  
I’ve got a mysql database that is properly configured, and a table  
called ‘quotes’ with a column called ‘quote’, and an auto incrementing  
primary key of ‘id’. Below is my controller code and model, and the  
error I get. Anyone have any idea why this doesn’t just work? Btw,  
I’ve got Ruby 1.8.4 (2006-04-14) [i386-mswin32], and I can’t figure out  
what version of Rails (or even RubyGems…I used this last night to  
install Rails).

In app/controllers:  
class QuoteController \< ApplicationController  
scaffold :quote  
end

In app/models:  
class Quote \< ActiveRecord::Base  
end

Here is the error I got:

ArgumentError in Quote#index

Showing  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/templates/scaffolds/list.rhtml  
where line #13 raised:

wrong number of arguments (0 for 1)

Extracted source (around line #13):

10: \<% for entry in instance\_variable\_get(“@#{@scaffold\_plural\_name}”)  
%\>  
11:   
12: \<% for column in @scaffold\_class.content\_columns %\>  
13: \<%= entry.send(column.name) %\>  
14: \<% end %\>  
15: \<%= link\_to “Show”, :action =\> “show#{@scaffold\_suffix}”,  
:id =\> entry %\>  
16: \<%= link\_to “Edit”, :action =\> “edit#{@scaffold\_suffix}”,  
:id =\> entry %\>

RAILS\_ROOT: ./script/…/config/…  
Application Trace | Framework Trace | Full Trace

c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/templates/scaffolds/list.rhtml:13:in  
`quote' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in `\_run\_rhtml\_c\_\_dev\_ruby\_lib\_ruby\_gems\_1468\_gems\_actionpack\_14612465\_lib\_action\_controller\_templates\_scaffolds\_list’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/templates/scaffolds/list.rhtml:12:in  
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:10:in `\_run\_rhtml\_c\_\_dev\_ruby\_lib\_ruby\_gems\_1468\_gems\_actionpack\_14612465\_lib\_action\_controller\_templates\_scaffolds\_list’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`compile_and_render_template' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render\_template’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:251:in  
`render_file' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:168:in `render\_scaffold’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/scaffolding.rb:110:in  
`list' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:97:in `index’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:941:in  
`perform_action_without_filters' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform\_action\_without\_benchmark’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' c:/dev/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform\_action’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:408:in  
`process_without_filters' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process\_without\_session\_management\_support’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/session\_management.rb:117:in  
`process' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:115:in  
`handle_dispatch' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service’  
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start\_thread’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:67:in  
`dispatch' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require’  
script/server:3

c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/templates/scaffolds/list.rhtml:13:in  
`quote' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in `\_run\_rhtml\_c\_\_dev\_ruby\_lib\_ruby\_gems\_1468\_gems\_actionpack\_14612465\_lib\_action\_controller\_templates\_scaffolds\_list’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/templates/scaffolds/list.rhtml:12:in  
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:10:in `\_run\_rhtml\_c\_\_dev\_ruby\_lib\_ruby\_gems\_1468\_gems\_actionpack\_14612465\_lib\_action\_controller\_templates\_scaffolds\_list’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`compile_and_render_template' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render\_template’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:251:in  
`render_file' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:168:in `render\_scaffold’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/scaffolding.rb:110:in  
`list' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:97:in `index’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:941:in  
`perform_action_without_filters' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform\_action\_without\_benchmark’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' c:/dev/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform\_action’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:408:in  
`process_without_filters' c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process\_without\_session\_management\_support’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/session\_management.rb:117:in  
`process' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:115:in  
`handle_dispatch' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service’  
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start\_thread’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start’  
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:67:in  
`dispatch' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require' c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require’  
script/server:3

Request

Parameters: None

Show session dump

* * *

flash: !map:ActionController::Flash::FlashHash {}

Response  
Headers: {“cookie”=\>[], “Cache-Control”=\>“no-cache”}

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 13, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/2 "2006-08-13T14:16:21Z")

</div>

> wrong number of arguments (0 for 1)  
> 10: \<% for entry in instance\_variable\_get("@#{@scaffold\_plural\_name}")  
> .  
> .  
> .  
> 12: \<% for column in @scaffold\_class.content\_columns %\>

* * *

> 13:
> 
> \<%= entry.send(column.name) %\>

* * *

The error message is stating that you put in a wrong number of arguments  
(you aren’t passing any variables at all, where you should be passing  
one) in a certain function you were calling - - on line 13 - -  
something.SEND(1 varaiable here).

meaning, column.name doesn’t populate anything at all.  
one reason i could come up with is that the statment in line 12 (for  
column in …) doesn’t populate anything either (hence, the variable  
column is incorrect/nil) and that’s why you are getting your error.

i would check to see why @scaffold\_class.content\_columns isn’t  
working…how did the process of scaffolding go? did you do it before  
creating the columns in the table? afterwords?

anyhow, good luck, and welcome to ror.

harp

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 13, 2006, 3:31pm UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/3 "2006-08-13T15:31:41Z")

</div>

So I tried a few different things, and it turns out that the scaffold  
capability was choking because of the fact that I had a column name that  
was the singular form of the table. So the table was ‘quotes’ and it  
had a column named ‘quote’. When I changed the ‘quote’ column to be  
called ‘text’ instead, the scaffold worked just fine.

This seems like a bug to me…where would I report it?

harper wrote:

> > wrong number of arguments (0 for 1)  
> > 10: \<% for entry in instance\_variable\_get("@#{@scaffold\_plural\_name}")  
> > .  
> > .  
> > .  
> > 12: \<% for column in @scaffold\_class.content\_columns %\>
> 
> * * *
> 
> > 13:
> > 
> > \<%= entry.send(column.name) %\>
> 
> * * *
> 
> The error message is stating that you put in a wrong number of arguments  
> (you aren’t passing any variables at all, where you should be passing  
> one) in a certain function you were calling - - on line 13 - -  
> something.SEND(1 varaiable here).
> 
> meaning, column.name doesn’t populate anything at all.  
> one reason i could come up with is that the statment in line 12 (for  
> column in …) doesn’t populate anything either (hence, the variable  
> column is incorrect/nil) and that’s why you are getting your error.
> 
> i would check to see why @scaffold\_class.content\_columns isn’t  
> working…how did the process of scaffolding go? did you do it before  
> creating the columns in the table? afterwords?
> 
> anyhow, good luck, and welcome to ror.
> 
> harp

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 13, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/4 "2006-08-13T22:25:34Z")

</div>

Brian R. Robinson wrote:

> So I tried a few different things, and it turns out that the scaffold  
> capability was choking because of the fact that I had a column name that  
> was the singular form of the table. So the table was ‘quotes’ and it  
> had a column named ‘quote’. When I changed the ‘quote’ column to be  
> called ‘text’ instead, the scaffold worked just fine.

You’re sure it was the column name that was causing the problems? I just  
whipped the same type of app; a controller that scaffolded on :comment,  
where I had a ‘comments’ table with a column called ‘comment’, and a  
model called ‘Comment’, and everything worked fine.

db/schema.rb:  
create\_table :comments do |t|  
t.column :name, :string  
t.column :comment, :text  
t.column :user\_id, :integer  
end

controllers/comment\_controller.rb  
class CommentController \< ApplicationController  
scaffold :comment  
end

models/comment.rb  
class Comment \< ActiveRecord::Base  
end

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 13, 2006, 10:27pm UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/5 "2006-08-13T22:27:14Z")

</div>

Brian R. Robinson wrote:

> I can’t figure out  
> what version of Rails (or even RubyGems…I used this last night to  
> install Rails).

type 'rails --version" or “gem --version” at the console/command prompt  
to see what the version is of the respected apps.

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 19, 2006, 1:16pm UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/6 "2006-08-19T13:16:43Z")

</div>

I get the same error. I did the tutorial  
[http://instantrails.rubyforge.org/tutorial/index.html](http://instantrails.rubyforge.org/tutorial/index.html) created a database  
called cookbook2, table recipes with column “method” and it didnt’ like  
that.

version 1.1.2

James Schementi wrote:

> Brian R. Robinson wrote:
> 
> > I can’t figure out  
> > what version of Rails (or even RubyGems…I used this last night to  
> > install Rails).
> 
> type 'rails --version" or “gem --version” at the console/command prompt  
> to see what the version is of the respected apps.

---

<div class="post-metadata">

**Author:** ![Brian\_RSRobinson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ebca7d/32.png) [@Brian\_RSRobinson](https://www.ruby-forum.com/u/Brian_RSRobinson)\
**Post date:** [August 22, 2006, 6:09am UTC](https://www.ruby-forum.com/t/newbie-question-scaffold-not-working/102220/7 "2006-08-22T06:09:07Z")

</div>

On Aug 19, 2006, at 4:16 AM, Duana Stanley wrote:

> I get the same error. I did the tutorial  
> [http://instantrails.rubyforge.org/tutorial/index.html](http://instantrails.rubyforge.org/tutorial/index.html) created a  
> database  
> called cookbook2, table recipes with column “method” and it didnt’  
> like  
> that.
> 
> version 1.1.2

I think that is because method is already defined as a Method…

Merlin:~/rails cbeck$ irb  
irb(main):001:0\> d = 1  
=\> 1  
irb(main):002:0\> d.methods  
=\> [“to\_a”, “%”, “\<\<”, “respond\_to?”, “\>\>”, “divmod”, “&”, “type”,  
“integer?”, “chr”, “protected\_methods”, “eql?”, “to\_sym”, “\*”,  
“instance\_variable\_set”, “+”, “is\_a?”, “truncate”, “hash”, “send”,  
“to\_s”, “-”, “between?”, “modulo”, “singleton\_method\_added”, “prec”,  
“zero?”, “/”, “size”, “class”, “tainted?”, “private\_methods”,  
“ **send** ”, “next”, “|”, “untaint”, “id”, “~”, “step”, “to\_i”,  
“inspect”, “instance\_eval”, “prec\_i”, “remainder”, “clone”,  
“nonzero?”, “public\_methods”, “^”, “+@”, “floor”, “extend”, “freeze”,  
“-@”, “\*\*”, “quo”, “display”, “ **id** ”, “\<=\>”, “downto”, “to\_f”, “\<”,  
“method”, “methods”, “==”, “===”, “prec\_f”, “abs”, “\>”, “to\_int”,  
“nil?”, “dup”, “instance\_variables”, “coerce”, “\>=”, “instance\_of?”,  
“ceil”, “\<=”, “upto”, “div”, “times”, “object\_id”, “=~”,  
“singleton\_methods”, “equal?”, “succ”, “taint”, “id2name”, “[]”,  
“frozen?”, “instance\_variable\_get”, “kind\_of?”, “round”]  
irb(main):003:0\> d.method  
ArgumentError: wrong number of arguments (0 for 1)  
from (irb):3:in `method’  
from (irb):3  
irb(main):004:0\>

I’m not sure of the intricacies of rails but this would be my guess.

–  
Craig B.

[http://www.luckybonza.com](http://www.luckybonza.com)  
AIM: kreiggers
