title: HTML partial rendered in JS view is empty
body: <p>I have a model <code>Session</code>, which <code>has_many</code> <code>ExperimentSessions</code>. In <code>sessions/show.js.erb</code> I render a <code>Session</code>'s <code>ExperimentSessions</code> using a partial:</p>
  
  <pre><code>#/sessions/show.js.erb
  &lt;% out = '' %&gt;
  &lt;% fields_for @session do |sess_f| %&gt;
    &lt;%  sess_f.fields_for :experiment_sessions, child_index: "", index:nil  do |f| %&gt;
      &lt;% out += j "&lt;li class='list-group-item'&gt;"%&gt;
      &lt;% out += j render partial: 'experiment_sessions/exp_sess', locals: {f:f}  %&gt;
      &lt;% out += j "&lt;/li&gt;"%&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This works well. However, I'd like to put this into its own partial view to reuse it. I have this:</p>
  
  <pre><code>#/sessions/_exp_sessions_li.html.erb
  &lt;% fields_for session do |sess_f| %&gt;
    &lt;%  sess_f.fields_for :experiment_sessions, child_index: "", index:nil  do |f| %&gt;
      &lt;%= "&lt;li class='list-group-item'&gt;"%&gt;
      &lt;%= render partial: 'experiment_sessions/exp_sess', locals: {f:f}  %&gt;
      &lt;%= "&lt;/li&gt;"%&gt;
    &lt;% end%&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>and include it in <code>show.js.erb</code>:</p>
  
  <pre><code>#/sessions/show.js.erb
  &lt;% out = j(render(partial: 'exp_sessions_li', locals: {session: @session}  )) %&gt;
  </code></pre>
  
  <p>From the logs, there are no errors, and the partials get rendered. However, <code>out</code> is the empty string.
  Why does <code>_exp_sessions_li.html.erb</code> produce empty output?</p>
  
  <p><hr>
  <strong>Edit: clarify logs</strong></p>
  
  <p><code>logger.ap @session</code> output in <code>show.js.erb</code>:</p>
  
  <pre><code>#&lt;Session:0x007fc4859748d8&gt; {
              :id =&gt; 732187210,
     :recorded_on =&gt; Fri, 20 Mar 2015 00:00:00 EDT -04:00,
           :notes =&gt; "session_j_b_ 15",
      :created_at =&gt; Fri, 20 Mar 2015 00:00:00 EDT -04:00,
      :updated_at =&gt; Fri, 20 Mar 2015 00:00:00 EDT -04:00
  }
  </code></pre>
  
  <p><code>logger.ap @session.experiment_sessions</code> shows these objects as well. <code>session</code> is also visible as expected in <code>/sessions/_exp_sessions_li.html.erb</code>.</p>
  
  <p>Log indicates the partials get rendered:</p>
  
  <pre><code>Rendered experiment_sessions/_exp_sess.html.erb (0.7ms)
  Rendered experiment_sessions/_exp_sess.html.erb (0.6ms)
  Rendered sessions/_exp_sessions_li.html.erb (4.9ms)
  </code></pre>
  
  <p><hr>
  <strong>Edit: drill down on partial</strong></p>
  
  <p>Replacing the contents of <code>_exp_sessions_li.html.erb</code> with a string will render that string. Furthermore, if I edit this file to be</p>
  
  <pre><code>aa
  &lt;% fields_for session do |sess_f| %&gt;
    bb
    &lt;% sess_f.fields_for :experiment_sessions, child_index: "", index:nil  do |f| %&gt;
      cc
      &lt;%= "&lt;li class='list-group-item'&gt;"%&gt;
      &lt;%= render partial: 'experiment_sessions/exp_sess', locals: {f:f}  %&gt;
  [...]
  </code></pre>
  
  <p>will only show '<code>aa</code>' in <code>out</code>. So <code>fields_for</code> seems to eat the output. Note that the logs still say <code>exp_sess</code> gets rendered.</p>
  
  <p>Now, if I write <code>&lt;%= fields_for session do |sess_f| %&gt;</code>, output also contains '<code>bb</code>'. And adding <code>&lt;%= sess_f.fields_for ...</code> also the rest. The raw HTML parts (<code>&lt;li ..</code>) are escaped, however.</p>