I having trouble with an Ajax response in Rails and I don't know how to go about debugging it.
This code works as expected:
View
<div id="<%= dom_id(comment) %>_count">
<%= Like.where("comment_id = ?", comment.id).count %>
</div>
.js.erb response
$("#<%= dom_id(@comment) %>_count").html("<%= Like.where('comment_id = ?', @comment.id).count %>");
However, if I add in a link_to, the response stops working. Any help on what might be going on would be greatly appreciated.
View
<div id="<%= dom_id(comment) %>_count">
<%= link_to Like.where("comment_id = ?", comment.id).count, "#" %>
</div>
.js.erb response
$("#<%= dom_id(@comment) %>_count").html("<%= link_to Like.where('comment_id = ?', @comment.id).count, "#" %>");