merb 0.9.5 session_secret_key has changed

2008 September 2
tags: ,
by robertor

Being new to merb, I kept getting this error message after generating a basic merb 0.9.5 app:

~ Maybe the site's session_secret_key has changed? - Merb::CookieSession::TamperedWithCookie)
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.5/lib/merb-core/dispatch/session/cookie.rb:162:in `unmarshal'
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.5/lib/merb-core/dispatch/session/cookie.rb:77:in `initialize'
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.5/lib/merb-core/dispatch/session/cookie.rb:14:in `new'
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.5/lib/merb-core/dispatch/session/cookie.rb:14:in `setup_session'

What I didn’t know was that I needed to uncomment (and set) the :session_id_key in init.rb:

# Sets up a custom session id key which is used for the session persistence
# cookie name.  If not specified, defaults to '_session_id'.
# c[:session_id_key] = '_session_id'

The comments threw me off since I was expecting a default value.

Update:
It’s hard to find good merb tutorials right now. I wish I had seen the first of these two posts in advance. It specifically says to uncomment the session_id_key:

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS