allows voting only in one origin: booth or web

This commit is contained in:
rgarcia
2017-10-02 16:22:31 +02:00
parent 0147401fbe
commit 085991c624
10 changed files with 179 additions and 4 deletions

View File

@@ -15,6 +15,6 @@ class Poll::Answer < ActiveRecord::Base
scope :by_question, ->(question_id) { where(question_id: question_id) }
def record_voter_participation
Poll::Voter.find_or_create_by!(user: author, poll: poll)
Poll::Voter.find_or_create_by!(user: author, poll: poll, origin: "web")
end
end