In my Rails 3 controller I had this simple piece of code:
respond_to do |format|
render layout: "embed"
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!