Skip to content
Browse files

Ignore indexes ftw. Secretz page now actually loads.

  • Loading branch information...
1 parent fa452e9 commit 31726295ddbb7143bb310d2452d0b2fd49d837b3 @sudara committed Sep 14, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 app/models/listen.rb
View
7 app/models/listen.rb
@@ -82,8 +82,11 @@ def self.most_active_ips(limit=25)
Listen.count(:all, :group => :ip, :conditions => ['created_at > ?',30.days.ago], :order => 'count_all DESC', :limit => limit)
end
- def self.most_active_tracks(limit=25)
- Listen.count(:all, :group => :asset, :conditions => ['created_at > ?',30.days.ago], :order => 'count_all DESC', :limit => limit)
+ def self.most_active_tracks(limit=10)
+ Listen.count(:all,
+ :from => "listens IGNORE INDEX(index_listens_on_asset_id)",
+ :group => :asset,
+ :conditions => ['created_at > ?',30.days.ago], :order => 'count_all DESC', :limit => limit)
end
def self.find_user_by_ip(ip)

0 comments on commit 3172629

Please sign in to comment.
Something went wrong with that request. Please try again.