Add token string attribute to Poll Answer

This commit is contained in:
Bertocq
2017-10-06 14:28:57 +02:00
parent 6e29b6adf5
commit 1806bd3df4
3 changed files with 9 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ class Poll::Answer < ActiveRecord::Base
validates :question, presence: true
validates :author, presence: true
validates :answer, presence: true
validates :token, presence: true
# temporary skipping validation, review when removing valid_answers
# validates :answer, inclusion: { in: ->(a) { a.question.valid_answers }},
@@ -19,4 +20,4 @@ class Poll::Answer < ActiveRecord::Base
def record_voter_participation
Poll::Voter.find_or_create_by!(user: author, poll: poll, origin: "web")
end
end
end