merb 0.9.5 session_secret_key has changed
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: