fixes #670
This commit is contained in:
@@ -11,7 +11,8 @@ class FavoritesController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
if CurrentUser.favorite_limit.nil? || CurrentUser.favorite_count < CurrentUser.favorite_limit
|
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
|
else
|
||||||
@error_msg = "You can only keep up to #{CurrentUser.favorite_limit} favorites. Upgrade your account to save more."
|
@error_msg = "You can only keep up to #{CurrentUser.favorite_limit} favorites. Upgrade your account to save more."
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
$("a#add-to-favorites").hide();
|
$("a#add-to-favorites").hide();
|
||||||
$("a#remove-from-favorites").show();
|
$("a#remove-from-favorites").show();
|
||||||
|
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user