Skip to content

Instantly share code, notes, and snippets.

@gworley3
Created March 28, 2014 21:29
Show Gist options
  • Save gworley3/9843371 to your computer and use it in GitHub Desktop.
Save gworley3/9843371 to your computer and use it in GitHub Desktop.
DbCharmer - Getting Started - db_charmer.rb
SLAVE_DB_CONNECTIONS = (ENV['SLAVE_DATABASE_URLS'] || '').split(',').map do |db_url|
ENV[db_url] && Class.new(ActiveRecord::Base) { establish_connection(ENV[db_url]) }.connection
end.compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment