expunge: decrement user favorite counts.

This commit is contained in:
evazion
2017-08-03 22:45:10 -05:00
committed by r888888888
parent fd9dc6f647
commit af42740ca9
3 changed files with 11 additions and 15 deletions

View File

@@ -1038,7 +1038,9 @@ class Post < ApplicationRecord
end
def remove_from_favorites
Favorite.destroy_all(post_id: self.id)
favorites.find_each do |fav|
remove_favorite!(fav.user)
end
end
def remove_from_fav_groups