Sha256: 365c91813b7bb9730ab7e35440b76b398a1ec939a03d2da96b22bf630fb65fe6

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

module Tako
  module ActiveRecordExt
    module CollectionAssociation
      SHARDED_METHODS = [
        :reader,
        :writer,
        :ids_reader,
        :ids_writer,
        :create,
        :create!,
        :build,
        :any?,
        :count,
        :empty?,
        :first,
        :include?,
        :last,
        :length,
        :load_target,
        :many?,
        :reload,
        :size,
        :select,
        :uniq,
      ] & ActiveRecord::Associations::CollectionAssociation.public_instance_methods

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tako-0.6.0 lib/tako/active_record_ext/collection_association.rb
tako-0.5.0 lib/tako/active_record_ext/collection_association.rb
tako-0.4.1 lib/tako/active_record_ext/collection_association.rb
tako-0.4.0 lib/tako/active_record_ext/collection_association.rb