class MerryGoRound::Aggregation

Aggregation is the ActiveRecord store for aggregated data points. You should never create aggregations directly unless you know what you're doing.

Public Class Methods

for_key(key, granularity = MerryGoRound.granularities.first) click to toggle source
# File lib/merry_go_round/aggregation.rb, line 19
def self.for_key(key, granularity = MerryGoRound.granularities.first)
 where('key = ? AND granularity = ?', key, granularity)
end
table_name() click to toggle source
# File lib/merry_go_round/aggregation.rb, line 15
def self.table_name
  'merry_go_round_aggregations'
end

Private Instance Methods

valid_granularity() click to toggle source
# File lib/merry_go_round/aggregation.rb, line 25
def valid_granularity
  errors.add(:message, 'is not a valid granularity') unless MerryGoRound.granularities.include?(self.granularity.to_sym)
end