Developing in Rails 2.1 and deploying in Rails 2.0.2 (or error – undefined method time_zone)

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You are developing on the latest version of Rails (2.1), but your production server for deployment uses version 2.0.2 (as dreamhost is using at the moment).

Solution

  1. First change the environment.rb file to use the rails version in your deployment server
  2. You should probably be geting the error: undefined method = time zone by now, so make sure you comment out from further down your environment.rb file the line:
  3. Some further errors would be caused by the file config/initializers/new_rails_defaults.rb, so make sure you comment out the following lines:

You should be able to deploy and use your application now.