I would like to update a vote count by javascript.
My show action:
<%= render :partial => @car.reviews %>
The review partial has:
<p id="review_<%= review.id%>"><%= pluralize(review.votes_count, 'vote') %>
votes/create.js.erb
$("review_<%= review.id %>").html("<%= pluralize(review.votes_count, 'vote') %>");
The vote gets posted without any problem. But the javascript does not work, ActionView::Template::Error (undefined local variable or method `review’
So the solution is to include the loop in the .js.erb file.