title: Rails 3.1 insert ruby code in JavaScript file
body: <p>I am using Rails 3.2.12.<br>
  I would like to insert a ruby code in my asset JavaScript file: </p>
  
  <pre><code>function trim(string) {
    return string.replace(/(^\s+)|(\s+$)/g, "");
  }
  
  function &lt;%= controller_name %&gt;() {
  ...    
  }
  </code></pre>
  
  <p>How can I do this?<br>
  Thanks in advance.  </p>