Sha256: c0f8f0ab3e6fbb1868c11b0626ec6ecc8216269bff4c0dbb58fe9806986d837d
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 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 # module InertiaRails module InertiaDebugExceptions 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 if defined?(ActionDispatch::DebugExceptions) ActionDispatch::DebugExceptions.prepend InertiaRails::InertiaDebugExceptions end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inertia_rails-3.5.0 | lib/patches/debug_exceptions/patch-5-1.rb |