How do I render a partial of a different format in Rails?
I'm trying to generate a JSON response that includes some HTML. Thus, I have /app/views/foo/bar.json.erb : { someKey: 'some value', someHTML: "<%= h render(:partial => '/foo/baz') -%>" } I want it to render /app/views/foo/_baz.html.erb , but it will only render /app/views/foo/_baz.json.erb . Passing :format => 'html' doesn't help. Tim Haines Beginning with Rails 3.2.3, when calling render :partial (only works outside of the respond_to block). :formats => [:html] instead of :format => 'html' Sam Stokes What's wrong with render :partial => '/foo/baz.html.erb' ? I just tried this to render an