Heroku Rails 3.1 Checklist
So you have developed your shiny new app on your local computer using Ruby on Rails the brand new 3.1 release , you want to deploy it on Heroku, well you might run into unforeseen problems, this blog is to tell you how to avoid that headache.
1. Add Postgre SQL gem in gem-file
You most probably have developed application using Sqlite. When you upload your app to heroku and run the command heroku rake db:migrate , you might find a error that migrations have been aborted. Its because until Rails 3.0 , there is no need to add postgre sql gem into your gem file, now you need to. So open gem file your_app_path/Gemfile and add this:
at the end. But on your local machine you must run bundle install as bundle install –without production , that will prevent unnecessary installation of Postgre SQL gem into your PC.
2. Make assets compilable
Rails assets folder has .sass and .coffee files. These are not CSS and Javascript files as they need to be compiled to CSS and Javascript before use. On your local machine in development environment these things will be compiled every time you request a rails action, but on Heroku you must tell it to compile, else you will get an error.. To do so goto your_app_path/config/enviornments/production.rb and in line 18 ( or some thing around that if by any chance ) set config.assets.compile = true
Thats it, this should make your deployment on heroku pain free. If you still have trouble contact ruby forum.