Skip to content

Instantly share code, notes, and snippets.

@mikeauclair
Created May 15, 2013 18:19
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 mikeauclair/5586098 to your computer and use it in GitHub Desktop.
Save mikeauclair/5586098 to your computer and use it in GitHub Desktop.
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment