title: rails ujs - javascript not executing
body: <p>This is a very strange problem. I've got a rails app in which I am replacing one partial on the page with another using UJS. Recently, it stopped worked, so I started logging throughout the process to see where it broke. Here's what I found:</p>
  
  <ul>
  <li>After the link is clicked, the rails console tells me that everything rendered, including all the partials, and returns 200 OK.</li>
  <li>A puts in the controller actions returns fine</li>
  <li>A puts in the respond.do block returns fine</li>
  <li>A puts in the .js.erb file returns fine</li>
  </ul>
  
  <p>This means it's getting all the way to running the .js.erb file and evaluating the ruby with no errors. <strong>But here's what's weird - none of the javascript is executing.</strong> When I run an alert('hello?') in the .js.erb file, it's not executing.</p>
  
  <p>Has anyone ever run into this problem before? It seems exceedingly strange that it would run the erb evaluation but not the js. And no errors appear in the js console either.</p>
  
  <p>For the record I have: cleared the cache, restarted the browser, restarted the rails app, and nothing changed.</p>
  
  <p>Sample code: </p>
  
  <pre><code># view
  link_to 'example', some_path, :remote =&gt; true
  
  # controller
  respond_to do |format|
    format.js
  end
  
  # .js.erb file
  alert('this never shows up');
  &lt;% puts 'this shows up in the rails console' %&gt;
  </code></pre>
  
  <p>Thanks soo much to anyone who can shed a bit of light on this strange problem!</p>