title: Ruby on rails -- Render partial file inside .js.erb file
body: <p>In the HTML header this small javascript works:</p>
  
  <p>application.html.erb</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
                 alert("&lt;%= escape_javascript(render('resources/positions')) %&gt;");
  &lt;/script&gt;
  </code></pre>
  
  <p>But When I tried to put the same code in a js.erb file, it doesn't work.</p>
  
  <p>I tried to inlcude the file, but not working both ways:</p>
  
  <pre><code>&lt;script src="/assets/resources.js.erb" type="text/javascript"&gt;&lt;/script&gt;
  &lt;%= javascript_include_tag 'resources' %&gt;
  </code></pre>
  
  <p>app/assets/javascripts/resources.js.erb</p>
  
  <pre><code>alert("&lt;%= escape_javascript(render('resources/positions')) %&gt;");
  </code></pre>
  
  <p>any ideas ?</p>
  
  <p>Thanks in advance for any help.</p>