diff options
author | rhenium <re4k@re4k.info> | 2013-05-18 20:16:52 +0900 |
---|---|---|
committer | rhenium <re4k@re4k.info> | 2013-05-18 20:16:52 +0900 |
commit | 0b01cf035bb7c8048e9d69e59a0fc8176e4fb06c (patch) | |
tree | 1d78975503079fa712c17d57aca26ed4b83393c6 /app/controllers/errors_controller.rb | |
parent | 98913aad478401347b3de4061bb1d605e8b49934 (diff) | |
download | aclog-0b01cf035bb7c8048e9d69e59a0fc8176e4fb06c.tar.gz |
improve behavior when unknown format
Diffstat (limited to 'app/controllers/errors_controller.rb')
-rw-r--r-- | app/controllers/errors_controller.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 1755e05..e1d5dcf 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,5 +1,7 @@ class ErrorsController < ApplicationController layout "index" + skip_before_filter :check_format + before_filter :force_format def render_error @exception = env["action_dispatch.exception"] @@ -28,4 +30,11 @@ class ErrorsController < ApplicationController render "error", status: 500 end end + + private + def force_format + unless [:json, :html].include?(request.format.to_sym) + request.format = "html" + end + end end |