diff options
author | Rhenium <rhenium@rhe.jp> | 2014-03-13 19:41:46 +0900 |
---|---|---|
committer | Rhenium <rhenium@rhe.jp> | 2014-03-13 19:41:46 +0900 |
commit | c50b8b97993bd6e168afb34f25dac23c3f85ae6b (patch) | |
tree | e61033a9d36e94dc898255aa6c496af41c5f3bdd /app/controllers | |
parent | 2cea6a60d9e0e2fc90199084e5e99395e1b02964 (diff) | |
download | aclog-c50b8b97993bd6e168afb34f25dac23c3f85ae6b.tar.gz |
xhtml
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/concerns/controller_error_handling.rb | 7 |
2 files changed, 8 insertions, 7 deletions
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 |