votes: add is_deleted flag to post_votes table.
Add an is_deleted flag to post_votes so they can be soft-deleted in the future.
This commit is contained in:
@@ -12,6 +12,8 @@ class PostVote < ApplicationRecord
|
||||
scope :negative, -> { where("post_votes.score < 0") }
|
||||
scope :public_votes, -> { positive.where(user: User.has_public_favorites) }
|
||||
|
||||
deletable
|
||||
|
||||
def self.visible(user)
|
||||
user.is_admin? ? all : where(user: user).or(public_votes)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user