Skip to content

Instantly share code, notes, and snippets.

@Ch4s3
Created November 6, 2014 14:35
Show Gist options
  • Save Ch4s3/61bafa6a5324cb77fef9 to your computer and use it in GitHub Desktop.
Save Ch4s3/61bafa6a5324cb77fef9 to your computer and use it in GitHub Desktop.
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { 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