Sha256: 4e4e611446746f9e555d7cba9ce065e41a14038b72b1499bcc120a112def0809

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

require "active_support/concern"

module Tally
  module Countable

    extend ActiveSupport::Concern

    def increment_tally(key, by = 1)
      return if new_record?

      Tally.increment(key, self, by)
    end

    def tally_records(search_params = {})
      if search_params.present?
        RecordSearcher.search(search_params.merge(record: self))
      else
        Record.where(recordable: self)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tally-1.0.0.beta1 lib/tally/countable.rb