rails/rails — Issue #5308: Missing template for missing partial due to format confusion
Author: rgarver
Created: 2012-03-06 19:37:42+00:00
State: open

In Rails 3.2.2 if you render a template of a different format from the page (eg, embedding some json via jbuilder) the layout will start trying to render any partials as that format (json in the example earlier).

index.html.haml

```haml
%h1 Hi
:javascript
window.userJSON = #{render(:template => "users/show.json").html_safe}
```

layouts/welcome.html.haml

```haml
%html
%head
%body
=yield
=render :partial => 'layouts/analytics'
```

The above will fail unless I append `, :formats => [:html]` to the analytics partial.

I've put together a simple example of the failure case below:

https://github.com/rgarver/rails-nested-formats