class Octopus::RelationProxy
Constants
- ENUM_METHODS
methods redefined in
ActiveRecord
that should run_on_shard- ENUM_WITH_BLOCK_METHODS
`find { … }` etc. should run_on_shard, `find(id)` should be sent to relation
Attributes
ar_relation[RW]
Public Class Methods
new(shard, ar_relation)
click to toggle source
# File lib/octopus/relation_proxy.rb, line 14 def initialize(shard, ar_relation) @current_shard = shard @ar_relation = ar_relation end
Public Instance Methods
==(other)
click to toggle source
# File lib/octopus/relation_proxy.rb, line 46 def ==(other) case other when ::Octopus::RelationProxy method_missing(:==, other.ar_relation) else method_missing(:==, other) end end
Also aliased as: eql?
method_missing(method, *args, &block)
click to toggle source
# File lib/octopus/relation_proxy.rb, line 30 def method_missing(method, *args, &block) if ENUM_METHODS.include?(method) || block && ENUM_WITH_BLOCK_METHODS.include?(method) run_on_shard { @ar_relation.to_a }.public_send(method, *args, &block) elsif block @ar_relation.public_send(method, *args, &block) else run_on_shard do if method == :load_records @ar_relation.send(method, *args) else @ar_relation.public_send(method, *args) end end end end
respond_to?(*args)
click to toggle source
# File lib/octopus/relation_proxy.rb, line 19 def respond_to?(*args) method_missing(:respond_to?, *args) end