Bahn Dev

Adventures in web development

Deploying on Heroku

Heroku is very convenient for quick deployment and small apps. Deploying a 3.2 rails app can be trickier than earlier versions. The guides here and here gives the detailed instructions. Here is the summary:

  1. PostgreSQL as the database is required. When creating the app, add “-d=postgresql” at the end. For example, creating an app called demo, write “rails new demo -d=postgresql” in the console.
  2. Add “config.assets.initialize_on_precompile = false” at the end of config/application.rb
  3. Compile assets locally. First set the environment variable to production using “set RAILS_ENV=production“, compile using “bundle exec rake assets:precompile.” Don’t forgot to set RAILS_ENV back to development once you’re done.
  4. If you haven’t already, initialize git (“git init“), add all changes (“git add .“), and commit (“git commit -am ‘init’ “).
  5. Create the heroku app (“heroku create“) and deploy (“git push heroku master“)!

Create an alias in Windows

use “doskey alias=original”

Find Devise Routes

Use “rake routes”

Creating a Windows virtual drive

To make the command line a bit neater and organize my Rails projects, I like to make a virtual drive using the “SUBST” command. Without it my working directory for Rails projects would look like this:


  1. Open the Rail Command Prompt (“Start Command Prompt with Ruby”):
  2. Use the SUBST command:

    In this case the directory “C:\Users\Fawzi\Documents\My Dropbox\Personal\Programming\Rails” will be assign to the virtual drive R. If your directory path doesn’t include spaces (as mine does in this case), you don’t need to put quotes around it.

  3. Switch to the R virtual drive:
  4. Now we get a much neater-looking console than the one we started with:
    It also helps shows up in the file browser:

Post Navigation


Get every new post delivered to your Inbox.