Just trying out a simple rails app, mostly going for an API backend with JSON, heavy client side app. So what i want to do is only render the layout, and have javascript code handle the url, and make the ajax request to get the json data. The following seems to work:
respond_to do |format|
format.html { render :nothing => true, :layout => true }
end
However, since nothing is meant to render nothing, it feels kinda wrong. Is there a more proper way to just render the layout? Note that my layout does not have a yield.
Try this, this will render the response to a file called
sample.htmlwhich could be a static html file.and also you could have this file in a common location, so that you could loaded it to all the actions
have your static content in this page, and if you need a dynamic page you could have a
.erbpage tooin your method
HTH