diff options
Diffstat (limited to 'app/controllers/admin_track_controller.rb')
-rw-r--r-- | app/controllers/admin_track_controller.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb index 525c96782..bd0eee27b 100644 --- a/app/controllers/admin_track_controller.rb +++ b/app/controllers/admin_track_controller.rb @@ -7,9 +7,13 @@ class AdminTrackController < AdminController def list @query = params[:query] - @admin_tracks = TrackThing.paginate :order => "created_at desc", :page => params[:page], :per_page => 100, - :conditions => @query.nil? ? nil : ["lower(track_query) like lower('%'||?||'%')", @query ] - @popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;") + if @query + track_things = TrackThing.where(["lower(track_query) like lower('%'||?||'%')", @query]) + else + track_things = TrackThing + end + @admin_tracks = track_things.paginate :order => "created_at desc", :page => params[:page], :per_page => 100 + @popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;") end private |