Sha256: beeb39218a7ab4ef6c02876a6fe421f13a8a27c88f44b7cb34675e0bce93fb46

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

module Tako
  module ActiveRecordExt
    module AssociationRelation
      def self.included(mod)
        mod.extend(ShardedMethods)
        mod.sharded_methods :any?,
                            :build,
                            :count,
                            :create,
                            :create!,
                            :delete,
                            :delete_all,
                            :destroy,
                            :destroy_all,
                            :empty?,
                            :find,
                            :first,
                            :include?,
                            :last,
                            :length,
                            :many?,
                            :pluck,
                            :select,
                            :size,
                            :sum,
                            :to_a,
                            :uniq
      end

      def current_shard
        @association.owner.current_shard
      end
    end
  end
end

ActiveRecord::AssociationRelation.class_eval do
  include Tako::ActiveRecordExt::AssociationRelation
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tako-0.3.2 lib/tako/active_record_ext/association_relation.rb
tako-0.3.1 lib/tako/active_record_ext/association_relation.rb
tako-0.3.0 lib/tako/active_record_ext/association_relation.rb