Upgrading to Rails 4 and Deploying it on Heroku
We just updated our site to use Rails 4 and successfully deployed it on Heroku. It is always a good practice to keep your websites up to date. It was really painful when we upgraded our projects from Rails 2 to 3 as it was a major release and lacked backward compatibilities.
However, the upgrade from Rails 3 to 4 isn't that painful. Here is the upgrade checklist.
1. Ruby 2.0 is preferred; 1.9.3+ required
2. Upgrade your Gemfile to use the latest version of gems(rails, saa-rails, coffee-rails)
3. There are some features in Rails 3 are now deprecated(extracted) as separate gems in Rails 4. Some of them are
gem 'actionpack-action-caching' gem 'actionpack-page-caching' gem 'rails-observers' gem 'activeresource' gem 'activerecord-depreacted_finders'
If you are using these features extensively in your app, include them as gems in Gemfile.
4. Update the routes and check the deprecations. Once the upgrade is successful in your local machine, you need to add some extra configuration to run a Rails 4 app in Heroku.
5. Include the gem 'rails_12factor' in the production group to add the gems previously used by Heroku(as plugins).
group :production do gem 'rails_12factor' end
5. Enable serve_static_assets in production.rb file, to serve the assets automatically from the public folder(with Rails 4) and deploy the app.
#config/environments/production.rb config.serve_static_assets = trueRun the test suite and make sure your upgrade to rails 4 was succcessful.
Join the conversation