Sha256: c0a866f8c3e63d6a5d01283a810d0303a3612f5af9bb2ccd21f3fdb63a96d9be

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

module Tako
  module ActiveRecordExt
    module ConnectionHandling
      def connection
        return Tako::Repository.create_proxy(@force_shard).connection if force_shard?
        if Tako::ProxyStack.top
          Tako::ProxyStack.top.connection
        else
          super
        end
      end
    end
  end
end

ActiveRecord::ConnectionHandling.class_eval do
  alias_method :connection_without_tako, :connection
  prepend Tako::ActiveRecordExt::ConnectionHandling
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tako-0.6.0 lib/tako/active_record_ext/connection_handling.rb