Chris Jenkins
Chris Jenkins

Reputation: 719

Setting up multiple databases for different environments

I'm fairly new to Ruby on Rails / Git and had a few questions about database setup for different environments. Right now I've got what I think is a pretty solid setup. I have all of my application code in my dropbox folder and I can push that to git and then I can push git to my dotcloud application.

Now for the question. I've got a local environment and a production environment. Should I be setting up two databases for my information or is there a way to synchronize the database and store a local copy? Or am I thinking about this the wrong way?

Upvotes: 0

Views: 379

Answers (1)

Dipali Nagrale
Dipali Nagrale

Reputation: 520

In rails for different enviornment we can set different databases.

In config/database.yml file. Set different database for different enviornment or you can set same database for two environment.

Eg. For setting different database:

For developement mode:

development:
  adapter: mysql
  encoding: utf8
  database: database_name
  username: root
  password: 
  host: localhost

For Production mode:

production:
  adapter: mysql
  encoding: utf8
  database: diff_database_name
  username: root
  password: 
  host: localhost

Upvotes: 1

Related Questions