This commit is contained in:
albert
2013-03-01 07:33:19 -08:00
parent 35724bef5c
commit 6a1db1197b
2 changed files with 3 additions and 1 deletions

View File

@@ -11,7 +11,8 @@ class FavoritesController < ApplicationController
def create
if CurrentUser.favorite_limit.nil? || CurrentUser.favorite_count < CurrentUser.favorite_limit
Post.find(params[:post_id]).add_favorite!(CurrentUser.user)
@post = Post.find(params[:post_id])
@post.add_favorite!(CurrentUser.user)
else
@error_msg = "You can only keep up to #{CurrentUser.favorite_limit} favorites. Upgrade your account to save more."
end

View File

@@ -3,4 +3,5 @@
<% else %>
$("a#add-to-favorites").hide();
$("a#remove-from-favorites").show();
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
<% end %>