module Switchman::ActiveRecord::Reflection::AbstractReflection

Public Instance Methods

shard(owner) click to toggle source
# File lib/switchman/active_record/reflection.rb, line 7
def shard(owner)
  if polymorphic? || klass.connection_classes == owner.class.connection_classes
    # polymorphic associations assume the same shard as the owning item
    owner.shard
  else
    Shard.default
  end
end