Skip to content

Conversation

@skryukov
Copy link
Contributor

@skryukov skryukov commented Aug 13, 2025

There are two ways to address the ActionView::MissingTemplate issue: using a respond_to block or forcing the :html format.

After clarification from @richardboehme, we decided to go with respond_to 😂

Fixes #248

@richardboehme
Copy link

Can confirm this works in our app. The server now always responds with HTML, no matter the requested content type.

@bknoles
Copy link
Collaborator

bknoles commented Aug 28, 2025

I played with this a bit today. I'm in favor of wrapping the renderer in a repond_to block.

IMO the issue is that we're raising a confusing exception.

With a respond_to block constraining us to html formats, Rails raises an UnknownFormat error, which I think is a helpful exception. Since there are still ways the app can decide to support /some_inertia_path.some_other_format if it wants to, coercing it in the renderer is overly prescriptive for me. What do you think?

@bknoles
Copy link
Collaborator

bknoles commented Aug 28, 2025

We could also constrain the format coercion to the static controller, perhaps... this seems to work if I forward the formats argument on to the render method call in the renderer:

module InertiaRails class StaticController < InertiaRails.configuration.parent_controller.constantize def static render inertia: params[:component], formats: [:html] end end end
@skryukov skryukov force-pushed the fix-missing-template-error branch from ef4c065 to 459d852 Compare August 29, 2025 18:33
@skryukov skryukov force-pushed the fix-missing-template-error branch from 459d852 to ac054bf Compare August 29, 2025 18:35
@bknoles bknoles merged commit f76c284 into inertiajs:master Aug 29, 2025
17 checks passed
@skryukov skryukov deleted the fix-missing-template-error branch August 31, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants