title: Whenever I refresh the page a method is being called
body: <p>I have an issue with a button on ruby on rails version 4. It seems as if every time I refresh a page the method update_likes is being called when I only call it what I click a button. Here is my code for the button on the model </p>
  
  <pre><code>%p 
    %b Likes:
    = @item.likes   
    = link_to "Like", :onclick =&gt; @item.update_likes      
  </code></pre>
  
  <p>and here is the method its calling (update_likes) from the controller</p>
  
  <pre><code>  def update_likes
      @item = Item.find(params[:id])
      @item.update_likes 
    end 
  </code></pre>
  
  <p>If I eliminate the :onclick => @item.update_likes nothing happens when i refresh the page but once I add it it calls the method on click and on refresh. </p>
  
  <p>Can anyone see my problem? </p>
  
  <p>Any suggestions would be helpful! Thank you</p>