Set database type when creating a new Rails app

I’ve just started to use Heroku to host my apps and have found that i keep editing the default database after i’ve created the Rails app.

Obviously this is very frustrating and was making me think i’d missed something, so i decided that there must be an easier way (and there’s always an easier way with Rails) and that i should go back and read the docs again….

And here it is… http://guides.rubyonrails.org/command_line.html#rails-with-databases-and-scm

… So to create a new rails app with a postgre database as default, run:

rails new –database=postgresql my_new_postgre_app

et voila… new app created with Postgre database!

Guess i need to re-read the docs 😛

Advertisements

About distinctinteractive

I graduated 3 years ago from the University of Huddersfield with a 2:1 BA in Interactive Multimedia. After leaving University i worked for a small company in Huddersfield (Offroad Code) mainly helping to maintain a large travel company website. I am currently freelancing as Distinct Interactive. Follow me on Twitter @jimmckerchar
This entry was posted in Ruby and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s