Wed 16 Jul 2008
Developing in Rails 2.1 and deploying in Rails 2.0.2 (or error - undefined method time_zone)
Posted by kosmas under ruby on rails
No Comments
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
- First change the environment.rb file to use the rails version in your deployment server
RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
- 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:
config.time_zone = 'UTC'
- Some further errors would be caused by the file config/initializers/new_rails_defaults.rb, so make sure you comment out the following lines:
ActiveRecord::Base.include_root_in_json = true ActiveRecord::Base.store_full_sti_class = true ActiveSupport.use_standard_json_time_format = true ActiveSupport.use_standard_json_time_format = true
You should be able to deploy and use your application now.