Module: Rails::Sharding::ActiveRecordExtensions::ScopeMethods

Defined in:
lib/rails/sharding/active_record_extensions.rb

Instance Method Summary collapse

Instance Method Details

#using_shard(shard_group, shard_name) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/rails/sharding/active_record_extensions.rb', line 29

def using_shard(shard_group, shard_name)
  if block_given?
    raise Errors::WrongUsageError,
      "#{name}.using is not allowed to receive a block, it works just like a regular scope.\nIf you are trying to scope everything to a specific shard, use Shards::Core.using_shard instead."
  end

  ScopeProxy.new(shard_group, shard_name, self)
end