In my Rails 3 controller I had this simple piece of code:
respond_to do |format| format.js format.html do render layout: "embed" end end
Turns out that at some point something or someone had given my application layout the filename
application.haml instead of
application.html.haml. This made it apply to all formats instead of just HTML.
Once I renamed the layout, the problem went away!