pundit: convert forum post votes to pundit.

This commit is contained in:
evazion
2020-03-18 02:43:45 -05:00
parent be59e85d25
commit cc2b4abd09
8 changed files with 54 additions and 27 deletions

View File

@@ -0,0 +1,13 @@
class ForumPostVotePolicy < ApplicationPolicy
def create?
unbanned? && policy(record.forum_post).votable?
end
def destroy?
unbanned? && record.creator_id == user.id
end
def permitted_attributes
[:score]
end
end