Class: StatisticCounter
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- StatisticCounter
- Defined in:
- app/models/statistic_counter.rb
Direct Known Subclasses
Instance Method Summary collapse
- #increment_counter ⇒ Object
-
#initialize(options = {}) ⇒ StatisticCounter
constructor
A new instance of StatisticCounter.
Constructor Details
#initialize(options = {}) ⇒ StatisticCounter
Returns a new instance of StatisticCounter.
4 5 6 7 |
# File 'app/models/statistic_counter.rb', line 4 def initialize( = {}) super( = {}) 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 |