Never render the full layout in a Rails view when called via AJAX
Essential for degradable javascript, when one never knows if a view or partial is being called via XmlHttpRequest or not. Throw the below code in your ApplicationController (application.rb)
More info in this blog post
More info in this blog post
def render(*args) args.first[:layout] = false if request.xhr? and args.first[:layout].nil? super end