I figured out how to do this using a custom ActionView::Responder
. See https://github.com/netzpirat/haml_coffee_assets/issues/80 for details of why this was needed and how I solved it.
Restricting which MIME types a template will render in Rails
-
16-01-2022 - |
Pregunta
Given:
- A
FooController
with abar
action - An ActionView template handler for the
custom
extension - A template at
app/views/foo/bar.custom
Is there a way to make Rails render that template only for HTML requests without renaming the template to bar.html.custom
?
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow