Switch (Upgrade?) My Web Application to Use Rails 2 (2.0.2)

My web application was using Rails 1.2.6. I decided to upgrade my application to use Rails 2.0.2.

I simply changed ‘1.2.6′ to ‘2.0.2′ in config/environment.rb:

RAILS_GEM_VERSION = ‘2.0.2′ unless defined? RAILS_GEM_VERSION #*handy - Use Rails 2.0.2 now from 1.2.6

It was time to fire up my application and I got the following warning:

*******************************************************************
* config.breakpoint_server has been deprecated and has no effect. *
*******************************************************************

I fixed the problem by commenting out the line in config/environments/development.rb:

# Enable the breakpoint server that script/breakpointer connects to
#config.breakpoint_server = true #*handy - Unused for Rails 2.0.2

Obviously, I put my comment there at the end… :)
One down… I fired up the server and got a hard error:

/!\ FAILSAFE /!\ Thu Apr 03 18:57:55 -0500 2008
Status: 500 Internal Server Error
A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key => “_myapp_session”, :secret => “some secret phrase of at least 30 characters” } in config/environment.rb

There was a little hint in the error message. I added the suggested line in config/environment.rb:


Rails::Initializer.run do |config|
   #*handy - Needed for Rails 2.0.2
   config.action_controller.session = { :session_key => “_myapp_session”, :secret => “some secret phrase of at least 30 characters” }

There was a :secret symbol which I changed to (obviously) something secret. :)
I recommend GRC’s Ultra High Security Password Generator for a good random string.

If you have a saved session before, be sure to clear it up by running “rake tmp:sessions:clear”.

Post in the comments if you have any question.

Leave a Reply