From c50b8b97993bd6e168afb34f25dac23c3f85ae6b Mon Sep 17 00:00:00 2001 From: Rhenium Date: Thu, 13 Mar 2014 19:41:46 +0900 Subject: xhtml --- app/controllers/application_controller.rb | 8 +------- app/controllers/concerns/controller_error_handling.rb | 7 +++++++ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index eb27964..76c5f8c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base protect_from_forgery - after_action :set_content_type_to_xhtml, :tidy_response_body + after_action :tidy_response_body helper_method :logged_in?, :current_user helper_method :authorized_to_show_user?, :authorized_to_show_user_best? @@ -46,12 +46,6 @@ class ApplicationController < ActionController::Base end private - def set_content_type_to_xhtml - if request.format == :html - response.content_type = "application/xhtml+xml" - end - end - def tidy_response_body if [:html, :xml, :rss, :atom].any? {|s| request.format == s } response.body = ActiveSupport::Multibyte::Unicode.tidy_bytes(response.body) diff --git a/app/controllers/concerns/controller_error_handling.rb b/app/controllers/concerns/controller_error_handling.rb index bcc1f48..2bb7468 100644 --- a/app/controllers/concerns/controller_error_handling.rb +++ b/app/controllers/concerns/controller_error_handling.rb @@ -21,5 +21,12 @@ module ControllerErrorHandling @message = t("error.not_found") render "shared/common_error", status: 404, formats: :html end + + rescue_from ActionView::MissingTemplate do + if request.format != :html + @message = t("error.not_found") + render "shared/common_error", status: 404, formats: :html + end + end end end -- cgit v1.2.3