Edgy Rails Circular Silliness
I’ve been using Rails Edge on a project for no particular reason. Today I did an svn update and things stopped working.
A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :secret => “some secret phrase” } in config/environment.rb
No problem – I followed those instructions and added the option to config/environment.rb. Then I got another problem.
ArgumentError (`name’ required): /vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie_performance_fix.rb:44:in `initialize’ /vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:129:in `write_cookie’
All I could find was this post. The resolution was to update everything, create a new project, and copy code in. I couldn’t be bothered with this, so I unfroze and went to gem rails (1.2.2). Now neither Mongrel or Webrick will start.
/opt/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/initializer.rb:328:in `send’: undefined method `session=’ for ActionController::Base:Class (NoMethodError)
Aaargh! I googled for the exception and found nothing. Eventually I check out initializer.rb and realise what’s happening. From config/environment.rb I remove
config.action_controller.session = { :secret => “some secret phrase” }
Problem gone.
Lessons? When I give up on one way of fixing a problem, completely back out of that fix before trying another.

4 Comments:
Argh... for some reasons this fix doesn't since to work for me. My rails app just stopped working 2 days ago on my shared host (hostmonster). I suspect they updated to the last rails version without warning us...
Anyway, I'm still stuck with this :
"
premature end of script headers: /home/triabull/public_html/geccoe/dispatch.cgi /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:328:in `send': undefined method `session=' for ActionController::Base:Class (NoMethodError)"
No matter if I remove the line "config.action_controller.session = {:secret => 'Some secret phrase'}" or not, it doesn't change anything.
Anywone knows how to get out of this hole?
Thanks
Frank
Hi Frank,
As far as I know, the session attribute is something added to Edge, but not to 1.2.x. So it doesn't look like an upgrade problem; quite the opposite.
It sure looks like something somewhere is calling "action_controller.session=", during , somewhere on initialisation.
Are you 100% sure you've removed the line? Are you 100% sure you've deployed the correct environment.rb.
Hey Paul,
I had to reinstall the whole application from scratch (I did it 2 times) and the second time was the good one!
argh sorry, I published the comment from another account. deneb = frank =)
Post a Comment
<< Home