Permalink
Browse files

Trying to fix an issue with PostgreSQL.

  • Loading branch information...
1 parent 986781a commit bcab847a506d003ea105c4c469acda60d48788c5 @tristandunn tristandunn committed Oct 11, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sparkline.rb
View
@@ -5,7 +5,7 @@ def self.included(model)
module ClassMethods
def counts_grouped_by_created_at_from_past(days)
- all :select => 'COUNT(id) AS count, created_at',
+ all :select => 'COUNT(id) AS count, DATE(created_at) AS created_at',
:group => 'DATE(created_at)',
:order => 'created_at DESC',
:limit => days / 1.day
@@ -18,7 +18,7 @@ def sparkline_data_from_past(days)
(0..(days - 1)).inject([]) do |result, day|
date = day.days.ago.to_date
record = records.find { |record|
- record.created_at && record.created_at.to_date == date
+ record.created_at && record.created_at == date
}
result << record.try(:count).to_i

0 comments on commit bcab847

Please sign in to comment.