Forum: Ruby on Rails Processing PersonController#create (for 192.168.1.50 at 2007

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hassan S. (Guest)
on 2007-07-20 21:36
(Received via mailing list)
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"=>"removed_email_address@domain.invalid"}}

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

How do you go about troubleshooting something like this?

TIA!

/* ruby 1.8.6 + rails 1.2.3 on SuSE Linux if that matters...*/
--
Hassan S. ------------------------ removed_email_address@domain.invalid
John R (Guest)
on 2007-07-20 22:05
(Received via mailing list)
Nothing there says anything about any error. What does the rest of the
dump say?
Hassan S. (Guest)
on 2007-07-20 22:26
(Received via mailing list)
On 7/20/07, John R <removed_email_address@domain.invalid> wrote:
>
> Nothing there says anything about any error. What does the rest of the
> dump say?

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"=>"removed_email_address@domain.invalid"}}


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! */
--
Hassan S. ------------------------ removed_email_address@domain.invalid
Adam C. (Guest)
on 2007-07-20 23:43
(Received via mailing list)
what's the code in your create action?

Adam
Hassan S. (Guest)
on 2007-07-20 23:57
(Received via mailing list)
On 7/20/07, Adam C. <removed_email_address@domain.invalid> wrote:
>
> what's the code in your create action?

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.

--
Hassan S. ------------------------ removed_email_address@domain.invalid
Adam C. (Guest)
on 2007-07-21 00:11
(Received via mailing list)
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
Hassan S. (Guest)
on 2007-07-21 02:36
(Received via mailing list)
On 7/20/07, Adam C. <removed_email_address@domain.invalid> wrote:
>
> 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?

<http://www.onlamp.com/pub/a/onlamp/2005/01/20/rail...

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

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

--
Hassan S. ------------------------ removed_email_address@domain.invalid
Hassan S. (Guest)
on 2007-07-21 21:16
(Received via mailing list)
A little more info, and I'm more puzzled than ever :-)

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?

???
--
Hassan S. ------------------------ removed_email_address@domain.invalid
John R (Guest)
on 2007-07-22 00:31
(Received via mailing list)
Well, that 'gem intall mysql' doesn't install a driver, rather native
bindings for ruby. It's totally an optional step, but it generally
speeds up db access.

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? If so, can we see the code for your
PersonController?

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'. Note: That'll blow away your controller, so
back it up if there's anything you might want later.

J
Hassan S. (Guest)
on 2007-07-22 19:04
(Received via mailing list)
On 7/21/07, John R <removed_email_address@domain.invalid> wrote:

> 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 :-)

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!
--
Hassan S. ------------------------ removed_email_address@domain.invalid
This topic is locked and can not be replied to.