提交 c1b1956a 编写于 作者: S Santiago Pastorino

Use status, content_type, body method signature for render too

上级 9611d561
module ActionDispatch
# A simple Rack application that renders exceptions in the given public path.
class PublicExceptions
attr_accessor :public_path
......@@ -12,15 +11,15 @@ def call(env)
status = env["PATH_INFO"][1..-1]
request = ActionDispatch::Request.new(env)
content_type = request.formats.first
format = content_type && "to_#{content_type.to_sym}"
body = { :status => status, :error => exception.message }
render(status, body, format, content_type)
render(status, content_type, body)
end
private
def render(status, body, format, content_type)
def render(status, content_type, body)
format = content_type && "to_#{content_type.to_sym}"
if format && body.respond_to?(format)
render_format(status, content_type, body.public_send(format))
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册