Processing PersonController#create (for 192.168.1.50 at 2007-07-20 10:19:55) [POST] ArgumentError in PersonController#create : wrong number of arguments (1 for 0)

New to rails, trying to do a pretty vanilla test-run app.

Here's the beginning of a log dump from the subject error (with a
little formatting for readability):

Processing PersonController#create (for 192.168.1.50 at 2007-07-20
10:19:55) [POST]
  Session ID: 41bc1e6351c24a63c12f97354da28e08
  Parameters: {"commit"=>"Create",
                      "action"=>"create",
                      "controller"=>"person",
                      "person"=>{"first_name"=>"Fred",
                                         "last_name"=>"Flintstone",
                                         "email"=>"fred@bedrock.com"}}

Neither this nor the rest of the log is telling me much :slight_smile:

How do you go about troubleshooting something like this?

TIA!

/* ruby 1.8.6 + rails 1.2.3 on SuSE Linux if that matters...*/

OK, here's the entire log sequence:

Processing PersonController#create (for 192.168.1.50 at 2007-07-20
10:19:55) [POST]
  Session ID: 41bc1e6351c24a63c12f97354da28e08
  Parameters: {"commit"=>"Create", "action"=>"create",
"controller"=>"person", "person"=>{"first_name"=>"Fred",
"last_name"=>"Flintstone", "email"=>"fred@bedrock.com"}}

ArgumentError (wrong number of arguments (1 for 0)):
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/scaffolding.rb:128:in
`initialize'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/scaffolding.rb:128:in
`new'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/scaffolding.rb:128:in
`create'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`send'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`perform_action_without_filters'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:632:in
`call_filter'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:638:in
`call_filter'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:438:in
`call'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:637:in
`call_filter'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
`perform_action_without_benchmark'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
`perform_action'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in
`send'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in
`process_without_filters'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in
`process_without_session_management_support'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in
`process'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in
`process'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
`dispatch'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in
`handle_dispatch'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in
`service'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /usr/local/ruby-1.8.6/lib/ruby/1.8/webrick/server.rb:82:in `start'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in
`dispatch'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/webrick.rb:59
    /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in
`require'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in
`require'
    /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
    /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
    script/server:3

Rendering /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/templates/rescues/layout.rhtml
(500 Internal Error)

/* and apologies for the unintended pasted content in the subject! */

what's the code in your create action?

Adam

Perhaps I'm confused by the tutorial I'm reading, but I thought this
was a built-in function delivered by 'scaffold'.

/person/list works fine if I've manually entered person data in to the
DB, as does /person/destroy, but the default create action fails.

yeah the default scaffolding actions should work. I was trying to
figure out if you added any custom methods to your create method..
Since it looks like somewhere along the line, a method is being called
with a parameter, where it shouldn't have one. What's the address of
the tutorial you're following?

Adam

<http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=3>

Note: I'm not following it exactly, more mapping it to my own little
trial app :slight_smile:

But the default `/person/new` page appears as it should, it's just the
operation fails on submit.

A little more info, and I'm more puzzled than ever :slight_smile:

Going back to step one in the tutorial , I realized I'd totally skipped the
'gem install mysql' instruction. Unfortunately, that fails miserably, but
that's for a separate post.

However, the USD64K question is: how can my rudimentary app read
and update the DB without the driver, and then fail on trying to create
a new entry?

???

Well, that 'gem intall mysql' doesn't install a driver, rather native
bindings for ruby. It's totally an optional step

Thanks for clarifying that! So I can ignore that issue for now.

That ArgumentError is strange. I tried to do a few noobish things
myself and couldn't replicate it. Have you written some of your own
actions in the PersonController?

I had, but removing them didn't change anything.

Also, I assume that you're doing the scaffolding by including the line
'scaffold :person' in the controller. Have you tried scaffolding the
other way? Try running the command 'script/generate scaffold
yourController yourModel'.

I tried this on a fresh new Rails instance and noticed that the controller
created for Person was 'people_controller', /not/ 'person_controller'.
Maybe some conflict there? In any case, it works fine now using the
second scaffold method, so let me wade back in and see what else I
can break :slight_smile:

At least I discovered Logger through this, but I'd be interested in any
pointers to general RoR troubleshooting tips/tricks/best practice.

Regardless, thanks for the help!