title: How can I render via CoffeeScript in Ruby on Rails 4
body: <p>I was trying to solve this problem for a while with no result.
  I've wanted to pass variables and load a render into a div using CoffeeScript in rails 4.
  (I'm using SpreeCommerce platform).</p>
  
  <p><strong>view:</strong></p>
  
  <pre><code>&lt;%= link_to taxonomy.name,root_path+'t/'+tid, {class: "uno", remote: true} %&gt;
  </code></pre>
  
  <p><strong>controller:</strong></p>
  
  <pre><code>  respond_to do |format|
      format.html
      format.js  # menu.js.coffee.erb
    end
  </code></pre>
  
  <p><strong>menu.js.erb.coffee:</strong></p>
  
  <pre><code>$('div#productos').html("&lt;%= escape_javascript(render :partial =&gt; /shared/products) %&gt;")
  </code></pre>
  
  <p>I'd like to load the page '_products.erb.html' and the partial processes the variables that I give it.  As soon as I know, view and controller are ok, the problem is in <em>menu.js.erb.coffee</em></p>
  
  <p>Any help will be apreciated!</p>
  
  <p><strong>ADDITIONAL:</strong></p>
  
  <p>I've modified the extension to .js.coffee.erb.  When I try to run the app, it shows me:</p>
  
  <blockquote>
    <p>"undefined method `render' for #&lt;#:0xa70317c>"</p>
  </blockquote>
  
  <p>I tryied using <code>&lt;%= raw escape_javascript( render :partial =&gt;...</code> almost always "render" method give me problems.</p>
  
  <p><strong>NEW INFO:</strong></p>
  
  <p>I added <code>gem 'coffee-script'</code> to the Gemfile (then '<code>bundle install</code>'). 
  Now, when I click the link_to, it shows me into the HTML <em>&lt;%= escape_javascript(render :partial => /shared/products) %></em> as a text instead of loading the "partial"... any suggestion please?</p>