Question

So I just upgraded from Ruby 1.8.7 to 1.9.3. Then from rails 2.3.18 to rails 3.0.20 but I'm running into this error

A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb

I have searched and seen all of the questions about this that say you need to add

MyApp::Application.config.secret_token = 'secret'

and I have that in my config/initializers/secret_token.rb. What else could give me this error?

I also have:

MyApp::Application.config.session_store :cookie_store, :key => 'some_key'

in my config/initializers/session_store.rb

I believe I could have missed something during my upgrade which is causing this error?

EDIT:

I was missing this in my environment.rb

TheHockeyCommunity::Application.initialize!

Now its working fine!

Cheers

Was it helpful?

Solution

It's likely you're missing some of the changes to the config files that you need in Rails 3 and your intitializer isn't being included. I made the same upgrade recently, you can check my changes. There's a lot of changes there that won't be useful to you, but pay attention to any changes to files at the root of the application and under config.

Also, make sure you have your app name (matching the initialize! line in config/environment.rb) and not "MyApp".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top