Class: Occurro::DailyCounter

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/occurro/daily_counter.rb

Class Method Summary collapse

Class Method Details

.increment_counters(model, count = 1) ⇒ Object



8
9
10
11
# File 'app/models/occurro/daily_counter.rb', line 8

def self.increment_counters(model, count = 1)
  counter = Occurro::DailyCounter.find_or_create_by_countable_type_and_countable_id_and_created_on(model.class.base_class.name, model.id, Date.today)
  counter.increment!(:total, count)
end