From 3a7317ea1aaf8e4f9b435299938679a5635783ff Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Thu, 24 May 2012 11:12:36 +0100 Subject: Redirect numeric request URLs in JSON mode too URLs such as http://localhost:3000/en/request/106.json should be redirected to the corresponding named URL, including the .json on the end. --- app/controllers/request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index bd2bfc974..07faf4445 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -54,7 +54,7 @@ class RequestController < ApplicationController # Look up by old style numeric identifiers if params[:url_title].match(/^[0-9]+$/) @info_request = InfoRequest.find(params[:url_title].to_i) - redirect_to request_url(@info_request) + redirect_to request_url(@info_request, :format => params[:format]) return end -- cgit v1.2.3 From 1a085e3b973726893dc220c060225dc42d9a4edb Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Mon, 28 May 2012 10:27:11 +0100 Subject: Improve explanation I struggled to understand this comment. I hope the new wording is clearer. --- app/controllers/request_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 07faf4445..2250747e1 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -304,9 +304,11 @@ class RequestController < ApplicationController # See if values were valid or not if !@existing_request.nil? || !@info_request.valid? - # We don't want the error "Outgoing messages is invalid", as the outgoing message - # will be valid for a specific reason which we are displaying anyway. + # We don't want the error "Outgoing messages is invalid", as in this + # case the list of errors will also contain a more specific error + # describing the reason it is invalid. @info_request.errors.delete("outgoing_messages") + render :action => 'new' return end -- cgit v1.2.3