diff --git a/app/controllers/favorites_controller.rb b/app/controllers/favorites_controller.rb index 127b72b90..9148c8aa6 100644 --- a/app/controllers/favorites_controller.rb +++ b/app/controllers/favorites_controller.rb @@ -19,6 +19,7 @@ class FavoritesController < ApplicationController end def destroy - Post.find(params[:id]).remove_favorite!(CurrentUser.user) + @post = Post.find(params[:id]) + @post.remove_favorite!(CurrentUser.user) end end diff --git a/app/views/favorites/destroy.js.erb b/app/views/favorites/destroy.js.erb index 96f3cf8cf..3394f959c 100644 --- a/app/views/favorites/destroy.js.erb +++ b/app/views/favorites/destroy.js.erb @@ -1,2 +1,3 @@ $("a#add-to-favorites").show(); $("a#remove-from-favorites").hide(); +$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);