I have a rails app of which I am running two server instances (different ports, different PID).
rails s -p 8081 -P 12345
rails s -p 8082 -P 54321
However, I would like each of them to connect to a different mongodb database (for example: db12345 and db54321, respectively).
The problem is that I don't know whether this is possible and if so, how to specify it in my mongoid.yml configuration file.
The respective section of my mongoid.yml file, allowing me to use the db12345 database, currently looks like this:
development:
options:
raise_not_found_error: false
sessions:
default:
database: **db12345**
hosts:
- localhost:27017
options:
max_retries: 30
retry_interval: 1
timeout: 15
refresh_interval: 10
What I am having trouble with is finding a way to link each instance of the same rails app to the (different) database it should use. Is this even meant to be dealt with in mongoid.yml?
Thank you!