good
我来做一下搬运工
application_controller.rb
def render_404
render_optional_error_file(404)
end
def render_403
render_optional_error_file(403)
end
def render_optional_error_file(status_code)
status = status_code.to_s
fname = %w(404 403 422 500).include?(status) ? status : 'unknown'
render template: "/errors/#{fname}", format: [:html],
handler: [:erb], status: status, layout: 'application'
end