Sha256: 6e5a574408a3bbea0a2e6bdde99b85ec5d74cf62316fe8b1104848e9565884ec

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

module Tako
  module ActiveRecordExt
    module ConnectionHandling
      module Prepend
        def connection
          if Tako::ProxyStack.top
            Tako::ProxyStack.top.connection
          else
            super
          end
        end
      end
    end

    module Base
      module Extend
        def shard(shard_name)
          if block_given?
            Tako.shard(shard_name) do
              yield
            end
          else
            Tako::QueryChain.new(
              Tako::Repository.shard(shard_name),
              self
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tako-0.2.2 lib/tako/active_record_ext.rb
tako-0.2.1 lib/tako/active_record_ext.rb
tako-0.2.0 lib/tako/active_record_ext.rb
tako-0.1.0 lib/tako/active_record_ext.rb