[RoR] Edge rails having problems with cookies and sessions?

Rails people,

I just installed edge rails 6334

Script/server comes up okay but when I try to connect to my site
the browser spits out a 500.

I see this in the console:

=> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://0.0.0.0:1111
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
DISPATCHER FAILSAFE RESPONSE (has cgi) Sun Mar 04 21:24:13 PST 2007
Status: 500 Internal Server Error
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

/pt/customers3/openwater/owcs/cs12/public/…/config/…/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:49:in
`initialize’

/Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/powerpc/lib/ruby/1.8/cgi/session.rb:273:in
`initialize_without_cgi_reader’

/pt/customers3/openwater/owcs/cs12/public/…/config/…/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb:32:in
`initialize’

I edited config/environment.rb like this:

Rails::Initializer.run do |config|
config.action_controller.session = { :secret => “some secret phrase X”
}
end

I bounced the server.

I tried the site and got another 500.

Now I see this:

Processing LoginController#index (for 127.0.0.1 at 2007-03-04 21:29:27)
[GET]
Session ID: f85a3a9b2667f3e0eb1c38f55dc2ede0
Parameters: {“action”=>“index”, “controller”=>“login”}

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’

Other people must be bumping into this issue; right?

I’ve done some searching with google; I see no evidence that others have
bumped into this bug.

Any clues on how to deal with this cookie_performance_fix.rb
ArgumentError ?

Info about my setup:

$ script/about
About your application’s environment
Ruby version 1.8.4 (powerpc-darwin7.9.0)
RubyGems version 0.9.0
Rails version 1.2.0
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Edge Rails revision 6334
Application root /owcs/cs12
Environment development
Database adapter mysql
Database schema version 112

-Peter

I just tried edge rails 6149
it seems to work okay
(after I removed
config.action_controller.session = { :secret => “some secret phrase X” }
from environment.rb)

It looks like some work has been done to sessions and cookies recently
but I’m not finding any clues on how to work around the 500 I see when
I try to create a session object in edge rails 6334.

Do I need to make some changes to my environment or install a gem or
something?

-Peter

On 3/4/07, Peter S. [email protected] wrote:

=> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)
initialize' Rails::Initializer.run do |config| [GET]write_cookie’

Edge Rails revision 6334
Application root /owcs/cs12
Environment development
Database adapter mysql
Database schema version 112

-Peter


Peter S.
[email protected]
http://GoodJobFastCar.com

People,

I figured this out.

It boiled down to a mismatch between my RAILS_ROOT and my edge rails.

I did this to fix it…

-Install the latest version of Locomotive on my Mac
-update gems with “gem update --system”
-update rake with “gem update rake”
-rails a_new_app
-rake rails:freeze:edge
-copy in my database.yml, routes.rb, migrations, models, controllers,
views,
images, stylesheets, and layouts
(tip-toe around an extra line in application.rb)
-Add a line to environment.rb:
config.action_controller.session = { :secret => “some secret
phraseX” }

And script/server behaved like I like.

I’m happy now…

-Peter

Here’s the change that is causing your problem:

http://dev.rubyonrails.org/browser/trunk/actionpack/lib/
action_controller/session/cookie_store.rb

In short, you need to stuff something like the rdoc says in your
environment.rb:

config.action_controller.session = { :secret => “some secret phrase” }

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