title: Rails 3 UJS - controller gets called twice by link_to :remote
body: <p>I have a weird problem where JQuery is creating two AJAX requests for a link_to method. I am developing a Rails 3 app with JQuery for UJS. I have a toggle link which toggles between 'Follow' and 'Unfollow'</p>
  
  <p>My link is rendered as below:</p>
  
  <pre><code>&lt;span id="follow_link"&gt;
    &lt;a href="/tfollow_artist?id=8103103" data-method="post" data-remote="true" id="follow_artist" rel="nofollow"&gt;Unfollow&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>and my controller is setup so:</p>
  
  <pre><code>def tfollow_artist
    @artist = Artist.find(params[:id])
    if current_user.following?(@artist) 
      current_user.stop_following(@artist)
    else 
      current_user.follow(@artist)
    end
   end
  </code></pre>
  
  <p>which finally renders a js as:</p>
  
  <pre><code> $('#follow_link').html('&lt;%= escape_javascript(render :partial =&gt; "follow") %&gt;');
  </code></pre>
  
  <p>Which essentially replaces html contents of the '&lt;span id="follow_link"&gt;...&lt;/span&gt; with the same URL only with the text being different. For example, above will now be rendered as:</p>
  
  <pre><code>&lt;span id="follow_link"&gt;
    &lt;a href="/tfollow_artist?id=8103103" data-method="post" data-remote="true" id="follow_artist" rel="nofollow"&gt;Follow&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>However this is somehow causing JQuery to make two AJAX requests.</p>
  
  <p>Can any one see what is wrong here?</p>
  
  <p>I am using 'jquery-rails' gem which is copying the latest jquery-ujs file to my app. JQuery version is 1.4.3</p>