Upgrading from Rails v.3.1.0rc4 v.3.1.0rc5 on Heroku

by Anton Zolotov · 0 comments

Getting Rails 3.1rc4 to run on Heroku’s Celadon Cedar Stack was no easy feat to begin with, mostly because the new asset pipeline is not well documented.

After the rails 3.1 hackfest on July 14, a new release candidate came out. Unfortunately, merely updating rails broke things on Heroku. Here are the steps I took to get it to work with the newest rc5:

Upgrading an existing application from rc4

  1. In your gemfile, change

    gem 'rails', '3.1.0.rc4'

    to

    gem 'rails', '3.1.0.rc5'
  2. If you were using therubyracer-heroku, get rid of it.
  3. Add execjs to your gemfile:

    gem 'execjs'
  4. Run bundle update
  5. Adjust your application.rb. Change the line that reads

    -Bundler.require(:default, Rails.env) if defined?(Bundler)

    to

    Bundler.require *Rails.groups(:assets) if defined?(Bundler)
  6. Edit your production.rb:

    If you have the line

    config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx

    change it to

    config.action_dispatch.x_sendfile_header = nil
  7. Important! According to Heroku support, some older apps were having trouble with the javascript runtime, because of an incorrect path variable that is set when the application is created. To get around this, run

    heroku config:add PATH=vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin:bin

    and restart the application

    heroku restart

The complete gemfile should look like this:

source 'http://rubygems.org'

gem 'rails', '3.1.0.rc5'
gem 'pg'

group :assets do
  gem 'coffee-script'
  gem 'uglifier'
  gem 'sass-rails'
end

# Asset template engines
gem 'json'
gem 'sass'
gem 'jquery-rails'

# heroku
group :production do
  gem 'thin'
  gem 'execjs'
end

If you’re still having issues, post it in the comments or ask the phenomenal Heroku support.

Share
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • email
  • HackerNews
  • StumbleUpon

Leave a Comment

Previous post:

Next post: