Skip to content

Instantly share code, notes, and snippets.

@kronn
Created June 16, 2011 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kronn/1030123 to your computer and use it in GitHub Desktop.
Save kronn/1030123 to your computer and use it in GitHub Desktop.
In case you need to change Database config mid-flight
ActiveRecord::Base.connection_pool.disconnect!
ActiveRecord::Base.connection_handler.remove_connection(ActiveRecord::Base)
Rails.application.config.database = new_database_config # not strictly necessary
ActiveRecord::Base.configurations = new_database_config
ActiveRecord::Base.establish_connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment