title: How do I render a partial of a different format in Rails?
body: <p>I'm trying to generate a JSON response that includes some HTML.  Thus, I have <code>/app/views/foo/bar.json.erb</code>:</p>
  
  <pre><code>{
    someKey: 'some value',
    someHTML: "&lt;%= h render(:partial =&gt; '/foo/baz') -%&gt;"
  }
  </code></pre>
  
  <p>I want it to render <code>/app/views/foo/_baz.html.erb</code>, but it will only render <code>/app/views/foo/_baz.json.erb</code>.  Passing <code>:format =&gt; 'html'</code> doesn't help.</p>