module Card::Query::CardClass

Public Instance Methods

count_by_cql(spec) click to toggle source
# File lib/card/query/card_class.rb, line 10
def count_by_cql spec
  spec = spec.clone
  spec.delete(:offset)
  search spec.merge(return: "count")
end
find_each(**options, &block) click to toggle source
# File lib/card/query/card_class.rb, line 16
def find_each **options, &block
  # this is a copy from rails (3.2.16) and is needed because this
  # is performed by a relation (ActiveRecord::Relation)
  find_in_batches(**options) do |records|
    records.each(&block)
  end
end
find_in_batches(**options) { |records| ... } click to toggle source
Calls superclass method
# File lib/card/query/card_class.rb, line 24
def find_in_batches **options
  if block_given?
    super do |records|
      yield(records)
      Card::Cache.reset_soft
    end
  else
    super
  end
end