Module: Tako::ActiveRecordExt::AssociationRelation

Defined in:
lib/tako/active_record_ext/association_relation.rb

Constant Summary collapse

SHARDED_METHODS =
[
  :any?,
  :build,
  :calculate,
  :create,
  :create!,
  :delete,
  :delete_all,
  :destroy,
  :destroy_all,
  :empty?,
  :exists?,
  :include?,
  :length,
  :many?,
  :pluck,
  :select,
  :size,
  :load,
  :uniq,
] & ActiveRecord::AssociationRelation.public_instance_methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



26
27
28
29
# File 'lib/tako/active_record_ext/association_relation.rb', line 26

def self.included(mod)
  mod.extend(ShardedMethods)
  mod.sharded_methods *SHARDED_METHODS
end

Instance Method Details

#current_shardObject



31
32
33
# File 'lib/tako/active_record_ext/association_relation.rb', line 31

def current_shard
  @association.owner.current_shard
end