Hi @realDLee,
There are a couple of things I notice. The first is that in the javascript selector you use an instance variable @listing
and then in the link_to
you use a local variable, listing
. I’m guessing you want the instance variable.
Next, instead of listing_path(:id=> listing.id)
please try listing_path(@listing)
Finally, this isn’t your problem, but there is a view helper you can use that will output the listing_<%= @listing.id %>
for you. it is dom_id
you can read more about it here. So using this method you would do
$("#<%= dom_id(@listing) %> .favorite-btn")
I hope that helps, let me know how it works out and if you have any further trouble with this.
thanks,
-Chad