Class: StatisticCounter
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- StatisticCounter
show all
- Defined in:
- app/models/statistic_counter.rb
Instance Method Summary
collapse
Constructor Details
4
5
6
7
|
# File 'app/models/statistic_counter.rb', line 4
def initialize(options = {})
super(options = {})
set_default_date_to_current
end
|
Instance Method Details
#increment_counter ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'app/models/statistic_counter.rb', line 9
def increment_counter
sc = self.class.find_by_element_id_and_date_and_element_type( element_id, date, element_type )
if sc
sc.increment!(:counter)
else
save
end
end
|