RailsCasts Pro episodes are now free!

Learn more or hide this

Malet's Profile

GitHub User: Malet

Comments by

Avatar
ruby
class ActiveRecord::Base
  mattr_accessor :shared_connection
  @@shared_connection = {}

  def self.connection
    @@shared_connection[self.connection_config[:database]] ||= retrieve_connection
  end
end

This is a modified version I've used for projects that have multiple connections