views:

145

answers:

2

Hi guys,

I'm using ruby openid compliant library so I can be an openid consumer, I got the sample and when I try to start-up the service, it show errors like

/var/lib/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:163:in `ensure_session_key': A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb (ArgumentError)
from /var/lib/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:74:in `initialize'

any idea would be appreciated, thanks

+1  A: 

I don't know anything about ruby but I strongly suspect you need to change these two things.

  1. "_myapp_session"
  2. "some secret phrase"

1 should probably be a session id (How to get this in I have no idea). 2 could in theory be left alone but it's not very secret then.

Nifle
A: 

Just faced the same error. Although error message (as it often happens with ruby) is a bit messy, it says you exactly what to do: put that piece of code inside config/environment.rb.
To be specific, put it inside Rails::Initializer.run do |config| block.

Nikita Rybak