Is it possible to respond a json request with html instead of json?
I would like to do this:
respond_to do |format|
format.html { render 'page' }
format.json { render 'page' } #render an html page instead of a JSON response
end
but Rails will search for a ‘page.json’ and will throw an error.
You need to explicitly set format, content-type (default is
application/json) and layout (default is none):