Displaying 1 result from an estimated 1 matches for "storyratingtotals".
2007 Apr 13
0
mixin behavior
...he last month, and all time, and dump
the data into isolated tables to allow for quick reads. The logic is
pretty much identical for each instance. I just have a variance of
dates and a different table for each set of summary data. So I
defined a module (messy, I know):
---
module RatingTotals::StoryRatingTotals
def refresh_story_totals(date = Date.new(2007, 1, 1))
# Removed most the code.
ratings = Rating.find(:all,
:select => ''rateable_id, AVG(rating) as
average_rating, COUNT(id) as count '',
:conditions => ["ratea...