I want to get my templates rendered and the html/json saved in variables in some actions in my application. Something like:
def show
@var = Var.find(params[:id])
x = render "tmeplate1", format: :json
render nothing: true
end
When I call this actions I get an error: AbstractController::DoubleRenderError in VarsController#show
any other way I can use the templates and not rendering twice ?
You have written render two times in the method that why double render error comes. Use render_to_string
x = render_to_string "tmeplate1", format: :json
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