module InertiaRails::Controller

Public Instance Methods

redirect_back(fallback_location:, allow_other_host: true, **options) click to toggle source
Calls superclass method
# File lib/inertia_rails/controller.rb, line 28
def redirect_back(fallback_location:, allow_other_host: true, **options)
  capture_inertia_errors(options)
  super(
    fallback_location: fallback_location,
    allow_other_host: allow_other_host,
    **options,
  )
end
redirect_to(options = {}, response_options = {}) click to toggle source
Calls superclass method
# File lib/inertia_rails/controller.rb, line 23
def redirect_to(options = {}, response_options = {})
  capture_inertia_errors(response_options)
  super(options, response_options)
end

Private Instance Methods

capture_inertia_errors(options) click to toggle source
# File lib/inertia_rails/controller.rb, line 44
def capture_inertia_errors(options)
  if (inertia_errors = options.dig(:inertia, :errors))
    session[:inertia_errors] = inertia_errors
  end
end
inertia_location(url) click to toggle source
# File lib/inertia_rails/controller.rb, line 39
def inertia_location(url)
  headers['X-Inertia-Location'] = url
  head :conflict
end