Re: NoMethodError (undefined method `[]'' for nil:NilClass)

Gavin Sinclair
Thu, 05 May 2005 12:05:59 -0000

It''s not something that happens all the time, just with my code at the
moment, even after a Webrick restart.  So a simple test won''t show it.

I''ll go digging into the stack trace now; just thought someone may
have seen it before.

Thanks,
Gavin

On Thursday, May 5, 2005, 5:40:50 PM, Dee wrote:

> Strange! It would apear that ENV is nil. Can you reproduce this with a
> simple test?

> Zsombor


> On 5/5/05, Gavin Sinclair
<gsinclair-81uBx+iSpXA0n/F98K4Iww@public.gmane.org> wrote:
>> I''ve got this error suddenly cropping up.  The relevant bit of
>> development.log is reproduced below.  What can I learn from it?  My
>> problem is that none of _my_ code is mentioned in the stack trace.
>>
>> Any help appreciated.
>>
>> Thanks,
>> Gavin
>>
>> --------------- development.log:
>>
>> Processing Base#index (for 127.0.0.1 at Thu May 05 11:54:33 AUS Eastern
Standard Time 2005)
>>   Parameters: {"action"=>"index",
"controller"=>"portal"}
>>
>> NoMethodError (undefined method `[]'' for nil:NilClass):
>>     D:/Software/ruby/lib/ruby/1.8/cgi/session.rb:291:in `[]''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/cgi_process.rb:81:in
>> `session''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:681:in
>> `assign_shortcuts''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:326:in
>> `process''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:273:in
>> `process''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/dispatcher.rb:32:in
>> `dispatch''
>>     D:/home/gavin/Projects/CrapCollector/public/dispatch.rb:10
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/activesupport-1.0.3/lib/active_support/dependencies.rb:187:in
>> `load''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/activesupport-1.0.3/lib/active_support/dependencies.rb:187:in
>> `load''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/webrick_server.rb:84:in
>> `handle_dispatch''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/webrick_server.rb:35:in
>> `do_GET''
>>
>> D:/Software/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in
>> `__send__''
>>
>> D:/Software/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in
>> `service''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/httpserver.rb:92:in
`service''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/httpserver.rb:54:in
`run''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:150:in
`start_thread''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:144:in
`start''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:144:in
`start_thread''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:94:in
`start''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:89:in
`each''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:89:in
`start''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:79:in
`start''
>>     D:/Software/ruby/lib/ruby/1.8/webrick/server.rb:79:in
`start''
>>
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/webrick_server.rb:21:in
>> `dispatch''
>>     script/server:48
>>
>> Rendering
>>
D:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/templates/rescues/layout.rhtml
>> (500 Inter
>> nal Error)
>>
>> _______________________________________________
>> Rails mailing list
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>