- day_count = OldNode.count(:user_id, :distinct => true,
- :include => :changeset,
- :conditions => "timestamp > NOW() - INTERVAL 1 DAY")
- week_count = OldNode.count(:user_id, :distinct => true,
- :include => :changeset,
- :conditions => "timestamp > NOW() - INTERVAL 7 DAY")
- month_count = OldNode.count(:user_id, :distinct => true,
- :include => :changeset,
- :conditions => "timestamp > NOW() - INTERVAL 28 DAY")
+ day_count = OldNode.count(:user_id, :distinct => true, :joins => :changeset,
+ :conditions => "timestamp > NOW() - '1 DAY'::INTERVAL")
+ week_count = OldNode.count(:user_id, :distinct => true, :joins => :changeset,
+ :conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL")
+ month_count = OldNode.count(:user_id, :distinct => true, :joins => :changeset,
+ :conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL")