0

I would like to be able easily switch database in my rails application. The idea is simple:

  1. Same codebase for production and demonstration application
  2. Different database
  3. Clean minimal implementation

My thought was perhaps based on the hostname im calling my application from, to set the database or are there better options here?

Rubytastic
  • 15,001
  • 18
  • 87
  • 175
  • what's the problem with specifying another environment in `database.yml` and running your application in that environment? – trushkevich Sep 16 '15 at 06:02
  • @trushkevich Than it has to run 2x. Im looking for an option to have the application run 1x then just switch the database if a certain condition is met ( I was thinking about a subdomain demo.myapp.com ) and trigger thec correct database based on the environment – Rubytastic Sep 16 '15 at 08:01
  • I see, check this post http://stackoverflow.com/questions/16775795/rails-switch-connection-on-each-request-but-keep-a-connection-pool it looks like what you are searching for - you'll need to create a custom connection handler – trushkevich Sep 16 '15 at 10:26

0 Answers0