Sha256: 13333af776e8e31ff94c49de27387a2380886137ef67f45091c2f94de0c97f94
Contents?: true
Size: 1.07 KB
Versions: 30
Compression:
Stored size: 1.07 KB
Contents
# Patch ActionDispatch::DebugExceptions to render HTML for Inertia requests # # Original source (unchanged since Rails 5.1): # https://github.com/rails/rails/blob/5-1-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb # https://github.com/rails/rails/blob/5-2-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb # https://github.com/rails/rails/blob/6-0-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb # ActionDispatch::DebugExceptions.class_eval do prepend(InertiaDebugExceptions = Module.new do def render_for_browser_request(request, wrapper) template = create_template(request, wrapper) file = "rescues/#{wrapper.rescue_template}" if request.xhr? && !request.headers['X-Inertia'] # <<<< this line is changed only body = template.render(template: file, layout: false, formats: [:text]) format = "text/plain" else body = template.render(template: file, layout: "rescues/layout") format = "text/html" end render(wrapper.status_code, body, format) end end) end
Version data entries
30 entries across 30 versions & 2 rubygems