Problem with Log-In functionality in Rails 2.0.2

Hi,

I am facing problem with the Login functionality after upgrading to
Rails 2.0.2

When I login, I get a No Method Error:

NoMethodError in LoginController#login

You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]=

RAILS_ROOT: E:/InstantRails-1.6-win/InstantRails/rails_apps/lala
Application Trace | Framework Trace | Full Trace

app/controllers/login_controller.rb:174:in `login’

E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
send' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:inperform_action_without_filters’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in
call_filters' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:inperform_action_without_benchmark’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:inperform_action_without_caching’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
perform_action' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:incache’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
cache' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:inperform_action’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
send' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:inprocess_without_filters’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
process_without_session_management_support' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:inprocess’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
process' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:inhandle_request’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
dispatch' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:indispatch_cgi’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
dispatch' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:76:inprocess’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:74:in
synchronize' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:74:inprocess’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:159:in
process_client' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:158:ineach’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:158:in
process_client' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in
initialize' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:innew’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:ininitialize’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in
new' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:282:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:ineach’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:128:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/command.rb:212:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:281 E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:inload’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:innew_constants_in’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:inrequire’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:inrequire’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3

app/controllers/login_controller.rb:174:in login' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:insend’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
perform_action_without_filters' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:incall_filters’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
perform_action_without_benchmark' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
perform_action_without_caching' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:inperform_action’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
cache' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:incache’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
perform_action' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:insend’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
process_without_filters' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:inprocess_without_session_management_support’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
process' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:inprocess’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
handle_request' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:indispatch’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
dispatch_cgi' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:indispatch’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:76:in
process' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:74:insynchronize’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/rails.rb:74:in
process' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:159:inprocess_client’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:158:in
each' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:158:inprocess_client’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:ininitialize’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in
new' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in
initialize' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:innew’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:282:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:in
each' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:128:in
run' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/command.rb:212:inrun’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:281
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:inload’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:inload’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:innew_constants_in’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require' E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
E:/InstantRails-1.6-win/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require’
script/server:3

Request

Parameters:

{“user”=>{“name”=>“goodboy”,
“password”=>“badboy”}}

Show session dump


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

Response

Headers:

{“cookie”=>[],
“Cache-Control”=>“no-cache”}


And line #174 in mylogin controller happens to be:

@session[:user_id] = logged_in_user.id

Could anyone please guide me with this issue?

Cheers

Cass

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs