Module: InertiaRails::InertiaDebugExceptions
- Defined in:
- lib/patches/debug_exceptions.rb
Instance Method Summary collapse
-
#render_for_browser_request(request, wrapper, content_type = nil) ⇒ Object
Rails 8.2+ passes content_type as third argument.
Instance Method Details
#render_for_browser_request(request, wrapper, content_type = nil) ⇒ Object
Rails 8.2+ passes content_type as third argument
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/patches/debug_exceptions.rb', line 16 def render_for_browser_request(request, wrapper, content_type = nil) template = create_template(request, wrapper) file = "rescues/#{wrapper.rescue_template}" if Mime[:md] && content_type == Mime[:md] body = template.render(template: file, layout: false, formats: [:text]) format = 'text/markdown' elsif request.xhr? && !request.headers['X-Inertia'] 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 |