title: Rails link_to with ajax remote true not updating view
body: <p>I have this little app that has events. In my index view for events I iterate through all events and display some data. In inside the <code>each</code> loop I have a link to 'Upvote' a particular event, this is an ajax request. For some reasons my view wont update right away but update when I clicked 'Upvote' again. </p>
  
  <p>Here is my link to 'Upvote'</p>
  
  <pre><code>&lt;div id="upvote_link_&lt;%= event.id%&gt;"&gt;
     &lt;%= link_to('Upvote', upvote_event_path(event), method: :post, remote: true)%&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my <code>upvote</code> method where I increment the <code>votes</code> field.</p>
  
  <pre><code>  def upvote
      @event = Event.find(params[:id])
      Event.increment_counter(:votes, @event.id)
      respond_to do |format|
        format.js
      end 
    end
  </code></pre>
  
  <p>Next is my <code>upvote.js.erb</code> where I replaced the old <code>votes</code> value with the new value.</p>
  
  <pre><code>$('#upvotes_&lt;%= @event.id %&gt;').html("&lt;%= escape_javascript (render 'upvote', event: @event )%&gt;");
  </code></pre>
  
  <p>Next is my <code>_upvote.html.erb</code> partial that replaces the old <code>votes</code> value. </p>
  
  <pre><code>&lt;span style="font-family:MetaSerifOT-Book;font-size:13px;"&gt;
      &lt;%= pluralize(event.votes, "vote") %&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>The problem is when I clicked the 'Upvote' link my request goes through and the <code>votes</code> field in my Event model gets updated but the view wont update until I clicked <code>Upvote</code> again. I am not sure what is going on. Any ideas or suggestions?</p>
  
  <p><strong>Update</strong>
  This is where I set up the id: <code>upvotes_&lt;%= event.id %&gt;</code> I have isolated the <code>Votes</code> count inside a partial. </p>
  
  <pre><code>    &lt;div id="upvotes_&lt;%= event.id%&gt;"&gt;
              &lt;%= render 'upvote', event: event %&gt;
      &lt;/div&gt;
  </code></pre>