Module: Octopus::Model::SharedMethods

Included in:
ClassMethods, InstanceMethods
Defined in:
lib/octopus/model.rb

Instance Method Summary collapse

Instance Method Details

#using(shard) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/octopus/model.rb', line 12

def using(shard)
  if block_given?
    raise Octopus::Exception, <<-EOF
#{name}.using is not allowed to receive a block, it works just like a regular scope.

If you are trying to scope everything to a specific shard, use Octopus.using instead.
    EOF
  end

  if Octopus.enabled?
    Octopus::ScopeProxy.new(shard, self)
  else
    self
  end
end