Sha256: 196f85c395b6ad456519126e68894739d7bb54540f62f095761b960564b247f2

Contents?: true

Size: 917 Bytes

Versions: 4

Compression:

Stored size: 917 Bytes

Contents

# Patch ActionDispatch::DebugExceptions to render HTML for Inertia requests
#
# Rails has introduced text rendering for XHR requests with Rails 4.1 and
# changed the implementation in 4.2, 5.0 and 5.1 (unchanged since then).
#
# The original source needs to be patched, so that Inertia requests are
# NOT responded with plain text, but with HTML.

if defined?(ActionDispatch::DebugExceptions)
  if ActionPack.version.to_s >= '5.1'
    require 'patches/debug_exceptions/patch-5-1'
  elsif ActionPack.version.to_s >= '5.0'
    require 'patches/debug_exceptions/patch-5-0'
  elsif ActionPack.version.to_s >= '4.2'
    require 'patches/debug_exceptions/patch-4-2'
  elsif ActionPack.version.to_s >= '4.1'
    require 'patches/debug_exceptions/patch-4-1'
  else
    # No patch required, because text rendering for
    # XHR requests was introduced with Rails 4.1:
    # https://github.com/rails/rails/pull/11960
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inertia_rails-1.4.0 lib/patches/debug_exceptions.rb
inertia_rails-1.3.1 lib/patches/debug_exceptions.rb
inertia_rails-1.3.0 lib/patches/debug_exceptions.rb
inertia_rails-1.2.2 lib/patches/debug_exceptions.rb