Is it possible to reuse jbuilder-template in another controller method? In other words: how to explicitly say controller method to use concrete jbuilder-template?
From Rails guide
.
What if you want to render a template from an entirely different controller from the one that contains the action code? You can also do that with render, which accepts the full path (relative to app/views) of the template to render. For example, if you're running code in an AdminProductsController that lives in app/controllers/admin, you can render the results of an action to a template in app/views/products this way
def my_action
# some code here
render "products/show"
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With