Re: Salted Login Generator issues

Nikolaus Heger
Wed, 18 May 2005 02:03:46 -0000

I get the same error on signup.

The issue is that params[''user''] is nil, so accessing
params[''user''][''login''] crashes.

This is happening a lot in other methods in salted login generator, too.

There are 2 solutions:
1) always make sure params[''user'']  != nil
2) handle params[''user'']  == nil case in all methods.

What i need to know is _why_ it''s crashing - is it crashing because the
call to login is wrong / should have parameters / should not have
happened at all etc / or is it wrong because login should simply handle
params[''user''] == nil.

Do we blame the caller or the callee?

	N.

On May 18, 2005, at 7:39, Ben Bleything wrote:

>> When I hit the login action, I get errors in my log files.  The
>> specific
>> error with trace is included below.  Unfortunately, I''m a
ruby/rails
>> newb and my skills don''t seem to be strong enough to track
this one
>> down.
>
> Wooo.  Way to include the log.  Here we go:
>
> Processing UserController#login (for 192.168.243.123 at Tue May 17
> 17:28:33 PDT 2005)
>   Parameters: {"action"=>"login",
"controller"=>"user"}
>   User Columns (0.000966)   SHOW FIELDS FROM users
> Rendering user/login within layouts/scaffold
>   User Columns (0.000815)   SHOW FIELDS FROM users
> Rendering layouts/scaffold (200 OK)
>   User Columns (0.000806)   SHOW FIELDS FROM users
>
>
> NoMethodError (undefined method `[]'' for nil:NilClass):
>     app/controllers/user_controller.rb:8:in `login''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/base.rb:708:in `send''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/base.rb:708:in `perform_action_without_filters''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/filters.rb:294:in
`perform_action_without_benchmark''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/benchmarking.rb:37:in
> `perform_action_without_rescue''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/benchmarking.rb:37:in `measure''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/benchmarking.rb:37:in
> `perform_action_without_rescue''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/rescue.rb:79:in `perform_action''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/base.rb:330:in `send''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/base.rb:330:in `process''
>
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/base.rb:273:in `process''
>
> /usr/local/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/dispatcher.rb:32:in
> `dispatch''
>     /opt/www/toolbox/public/dispatch.fcgi:20
>     /opt/www/toolbox/public/dispatch.fcgi:18:in `each_cgi''
>     /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each''
>     /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi''
>     /opt/www/toolbox/public/dispatch.fcgi:18
>
>
> Rendering
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/
> action_controller/templates/rescues/layout.rhtml (500 Internal Error)
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>