Module: Believer::Counting

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/believer/counting.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#has_counter_diffs?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'lib/believer/counting.rb', line 21

def has_counter_diffs?
  self.class.counter_columns.any? do |col|
    counter = self.send(col.name)
    counter && counter.diff > 0
  end
end

#is_counter_instance?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/believer/counting.rb', line 17

def is_counter_instance?
  self.class.is_counter_table?
end