This commit is contained in:
r888888888
2013-06-10 18:12:57 -07:00
parent df7bbcd4d1
commit 61f8c38d34
2 changed files with 4 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ class Favorite < ActiveRecord::Base
User.update_all("favorite_count = favorite_count + 1", {:id => user.id})
user.favorite_count += 1
post.fav_count += 1
post.score += 1
end
def self.remove(post, user)
@@ -31,5 +32,6 @@ class Favorite < ActiveRecord::Base
User.update_all("favorite_count = favorite_count - 1", {:id => user.id})
user.favorite_count -= 1
post.fav_count -= 1
post.score -= 1
end
end