From 0674fdca15cb63f69af86fd918a42b76ff76423f Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 17 Jun 2014 13:20:29 -0400 Subject: [PATCH] fix dead "link to request" link --- app/models/bulk_update_request.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index edb564407..4a13002c4 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -14,6 +14,19 @@ class BulkUpdateRequest < ActiveRecord::Base before_validation :initialize_attributes, :on => :create after_create :create_forum_topic + module SearchMethods + def search(params) + q = where("true") + return q if params.blank? + + if params[:id].present? + q = q.where("id = ?", params[:id].to_i) + end + + q + end + end + def approve! AliasAndImplicationImporter.new(script, forum_topic_id, "1").process! update_attribute(:status, "approved") @@ -25,7 +38,7 @@ class BulkUpdateRequest < ActiveRecord::Base end def reason_with_link - "[code]\n#{script}\n[/code]\n\nh4. Reason\n\n#{reason}\n\n\"Link to request\":/bulk_update_requests/#{id}\n" + "[code]\n#{script}\n[/code]\n\nh4. Reason\n\n#{reason}\n\n\"Link to request\":/bulk_update_requests?search[id]=#{id}\n" end def reject!