This is for both RoR 3.2 and 4.0.0 beta1/RC1!
Example excerpt from Gemfile in your RoR application directory:
gem 'sqlite3', '1.3.7'
When running Rails server in development on your local computer (most likely a Mac or Linux), this works fine. However, if you wish to deploy your application to Heroku, you will not be able to include the SQLite gem, as Heroku only supports PostgreSQL.
What is necessary at this point is to change the Gemfile to use SQLite only for development (and test, if you wish) and use PostgreSQL for production.
Change the above code in the Gemfile to this:
group :development do gem 'sqlite3', '1.3.7' end group :production do gem 'pg', '0.14.1' end
Save the Gemfile, and reinstall the application using
bundle install --without production
at the shell prompt.
Update the local git repository with
git commit -am &quot;Gemfile.lock updated for Heroku deployment&quot;
Optional: Update GitHub (or other remote repository) with
Assuming that your Heroku account and application have been established already, deploy to Heroku. (If the name of the git branch is something other than “master” use the correct branch name instead of “master”.)
git push heroku master
Because of the way that Heroku works with Rails 4.0, a route will need to be added for your page to appear properly in Heroku if you choose to use Rails 4.0. Rails 3.2 does not require this route to be configured.
If you want to use these versions for your Heroku deployment, add
to the top of Gemfile, and change the Rails gem entry to
gem 'rails', '4.0.0.rc1'
If you have been using the 4.0.0.beta1 release of Rails, you will need to change the versions on some other gems to 4.0.0.rc1. (Coffee-rails is now up to 4.0.0.)
In changing from beta1 to RC1, replace the line
config.session_store :encrypted_cookie_store #...
config.session_store :cookie_store #...
in config/initializers/session_store.rb. The store will be automatically encrypted. Otherwise, “rails server” and the deployment to Heroku will fail.
Lastly, remember to “bundle install…” and “git commit…” before doing “git push heroku…”!