FIX: When 410 is received, display proper error message instead of generic.

This commit is contained in:
Faisal Abbas
2015-12-30 15:45:54 +05:00
parent e45caa7e2e
commit f2480aa81f
2 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,7 @@ class ApplicationController < ActionController::Base
if (request.format && request.format.json?) || (request.xhr?)
# HACK: do not use render_json_error for topics#show
if request.params[:controller] == 'topics' && request.params[:action] == 'show'
return render status: status_code, layout: false, text: (status_code == 404) ? build_not_found_page(status_code) : I18n.t(type)
return render status: status_code, layout: false, text: (status_code == 404 || status_code == 410) ? build_not_found_page(status_code) : I18n.t(type)
end
render_json_error I18n.t(type), type: type, status: status_code