I am new to Ruby on Rails development. I have been given a task to make some changes to an existing Ruby on Rails website, that was created by another ROR developer. My question is, how do I setup a local development environment that mimics the one the previous developer used? Are there certain files in the application that will guide me in this process? Such as how to connect to the staging database, which is the correct local server to run, etc..
I have been trying to figure this out for a couple of weeks now. On a previous project I made changes to the application, then pushed it to the staging version on heroku. I know that was a horrible way to do things, but I had no other choice. And, I don't want to have to do that again in this instance. Any help would be appreciated.
Step one: if the previous developer didn't leave you any setup notes, start by taking notes on what you learn, so the next developer to work on the project will get up and going quicker.
First, you'll want to be sure you're using the same version of ruby. Check the project's root for a .rvmrc or .ruby-version file or similar. You might be able to see what version is being used in prod as well.
Next, for the database configuration, look in config/database.yml for where it expects to find a database. Typically there will be one for development that runs on your local machine, one for test, and one for production, but there may be others as well. In our organization config/database.yml is a symlink to a config file in config/databases, and we have different setups for dev, qa, and production environments, plus custom ones for individual developers. If your company happens to have a development mode database in a 'central' location, you might be able to configure your setup to use that one instead of having to set it up on your own box.
Pay special attention to the 'test' database settings, as that database will get destroyed and recreated each time the tests run.
Next, run 'bundle install' and make sure all gems get installed without errors. Once you have all gems installed, you might want to just load the rails console to make sure the environment initializes properly. Next, try running the test suite via 'rake test' or 'rake spec'.
Hopefully once that's all running, you'll be able to start a local server via 'rails s' in a console and pointing your browser at localhost:3000. If the project uses other services like memcached, redis, or foreman, you might need to do additional setup for those things.
You might also like to read how Thoughtbot handles this, plus the comments about using vagrant.