From caacd3f86f28e1b2462d74b8e03f51e17de34186 Mon Sep 17 00:00:00 2001 From: albert Date: Sun, 3 Mar 2013 15:37:20 -0500 Subject: [PATCH] fixes #733 --- app/controllers/favorites_controller.rb | 3 ++- app/views/favorites/destroy.js.erb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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 %>);