Class: InertiaRails::StaticController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/inertia_rails/static_controller.rb

Instance Method Summary collapse

Instance Method Details

#staticObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/inertia_rails/static_controller.rb', line 5

def static
  # Checked at dispatch, not load: eager loading defines this class even
  # in apps that never draw an `inertia` route, and those must still boot.
  unless is_a?(::ActionController::Base)
    raise ArgumentError,
          '`config.parent_controller` must inherit from ActionController::Base to serve `inertia` routes, ' \
          "got #{InertiaRails.configuration.parent_controller.inspect}"
  end

  respond_to do |format|
    format.html { render inertia: params[:component], props: request.path_parameters[:props]&.deep_dup || {} }
  end
end