Skip to content

Instantly share code, notes, and snippets.

@fellix
Created October 19, 2011 12:33
Show Gist options
  • Select an option

  • Save fellix/1298169 to your computer and use it in GitHub Desktop.

Select an option

Save fellix/1298169 to your computer and use it in GitHub Desktop.
Ruby on Rails Multiple Connections
ActiveRecord::Base.class_eval do
def self.connection(key)
establish_connection(key)
self
end
end
Model.connection(:development).all
Model.connection(:production).all
Model.connection(:another).all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment