Sha256: 56b0d638610008b9d8190a55480956527517c38fb5ad72cead3abebfd2f6e84f
Contents?: true
Size: 595 Bytes
Versions: 15
Compression:
Stored size: 595 Bytes
Contents
# Adds current_shard as an attribute; provide a default # implementation of set_current_shard which considers # only the current ActiveRecord::Base.connection_proxy module Octopus module ShardTracking module Attribute def self.included(base) base.send(:include, Octopus::ShardTracking) end attr_accessor :current_shard def set_current_shard return unless Octopus.enabled? if ActiveRecord::Base.connection_proxy.block self.current_shard = ActiveRecord::Base.connection_proxy.current_shard end end end end end
Version data entries
15 entries across 15 versions & 4 rubygems