User new answerable_by method in ability

This commit is contained in:
kikito
2016-11-07 17:42:52 +01:00
parent 83fd70b048
commit 3255ca700f

View File

@@ -48,7 +48,7 @@ module Abilities
can :create, SpendingProposal
can :create, DirectMessage
can :show, DirectMessage, sender_id: user.id
can(:answer, Poll, Poll.current){ |poll| poll.current? }
can(:answer, Poll, Poll.answerable_by(user)){ |poll| poll.answerable_by?(user) }
can(:answer, Poll::Question, Poll::Question.answerable_by(user)) do |question|
question.answerable_by?(user)
end