Sha256: 3b4454c920d6b9d97f27b28933ee19e0e2c621c9c286b864eb34eb3852841ac6

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

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

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

ActiveRecord::Associations::CollectionProxy.class_eval do
  include Tako::ActiveRecordExt::CollectionProxy
end

Version data entries

3 entries across 3 versions & 1 rubygems

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