0

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?

2
  • What is your aim?. If its to safely back up the data on your production database. Use mysqldump. Assuming its a mysql database. Commented Oct 11, 2012 at 6:18
  • My aim is to figure out what the best practice is. Should I have a dev database that mirrors my live one or should it be separate? Also, the database config file in rails will be different in my local repo vs. my uploaded one. Do you just exclude that file from a git push? Commented Oct 11, 2012 at 6:32

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

That just made my life so much easier. You rock!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.