diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-12-18 15:42:53 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-12-18 15:42:53 +0000 |
commit | bbdcb09cb9eeb94e3244a22b1129a1e9521947f4 (patch) | |
tree | 4ad15f4138796087c32957261e8b9e7b6f59887b /app/controllers/admin_track_controller.rb | |
parent | 5cfcdaac505e60914ee4398cfe431bd5d21b58ed (diff) | |
parent | abdc92fd922dd82da85f7c00bdb50e85ed047714 (diff) |
Merge branch 'restful-admin-routes' into rails-3-develop
Diffstat (limited to 'app/controllers/admin_track_controller.rb')
-rw-r--r-- | app/controllers/admin_track_controller.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb index 085c9c6cc..63ee5c12e 100644 --- a/app/controllers/admin_track_controller.rb +++ b/app/controllers/admin_track_controller.rb @@ -5,7 +5,8 @@ # Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class AdminTrackController < AdminController - def list + + def index @query = params[:query] if @query track_things = TrackThing.where(["lower(track_query) like lower('%'||?||'%')", @query]) @@ -13,7 +14,14 @@ class AdminTrackController < AdminController 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;") + @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 + + def destroy + track_thing = TrackThing.find(params[:id].to_i) + track_thing.destroy + flash[:notice] = 'Track destroyed' + redirect_to admin_user_url(track_thing.tracking_user) end private |