Hi,
I’ve been fiddling around with rails for a while now. Following
books, tutorials etc.
But as soon as I tried to use sessions in my application, eg. by
calling session[:user] = ‘something’
All I get is “500 Internal Server Error”
(Both in webrick and mongrel) on OS X Leopard using ruby 1.8.6
I’ve also tried upgrading from rails 2.0.2 to 2.1.0
Log:
=================================================================================
/!\ FAILSAFE /!\ Sat Aug 02 21:17:45 +0200 2008
Status: 500 Internal Server Error
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.[]=
/Users/thomas/Ruby/kattene/app/controllers/application.rb:6:in
initialize' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:388:innew’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:388:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:171:inhandle_request’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:115:in dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:126:indispatch_cgi’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:9:in dispatch' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:76:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
rails.rb:74:in synchronize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:74:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:innew’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:ininitialize’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/
configurator.rb:282:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/
configurator.rb:281:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:
212:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:489:inload’
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:489:in load' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:342:innew_constants_in’
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:489:in load' /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/ mongrel.rb:64 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in require' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:496:inrequire’
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:342:in new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:496:inrequire’
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3
=================================================================================
From ApplicationController:
def initialize
session[:test] = ‘something’
end
It shouldn’t be anything wrong with this as far as I know.
Any response would be highly appreciated.
Thanks,
Thomas Pedersen