I want to implement a like-counter on an object. Everytime the 'I like' Button gets clicked I want to update the database-field of the object.
In the controllers show-view I placed following form:
<% form_for(@book) do |f| %>
<p>
<% @book.update_like(@book)%>
<%= f.submit "I like" %>
</p>
<% end %>
The update_like method is called in the book.rb model and looks like this:
def update_like(in_book)
in_book.like_tag = in_book.like_tag + 1;
end
The update_like methode is called, but the database is not update. I do not grasp what's going wrong. Any help is much appreciated.