Add letter origin back to poll voters

This commit is contained in:
Bertocq
2017-10-17 23:13:21 +02:00
committed by Javi Martín
parent e461c8d0ac
commit 118cce2f8f

View File

@@ -1,7 +1,7 @@
class Poll class Poll
class Voter < ApplicationRecord class Voter < ApplicationRecord
VALID_ORIGINS = %w{web booth}.freeze VALID_ORIGINS = %w[web booth letter].freeze
belongs_to :poll belongs_to :poll
belongs_to :user belongs_to :user
@@ -20,8 +20,9 @@ class Poll
before_validation :set_demographic_info, :set_document_info, :set_denormalized_booth_assignment_id before_validation :set_demographic_info, :set_document_info, :set_denormalized_booth_assignment_id
scope :web, -> { where(origin: "web") } scope :web, -> { where(origin: "web") }
scope :booth, -> { where(origin: "booth") } scope :booth, -> { where(origin: "booth") }
scope :letter, -> { where(origin: "letter") }
def set_demographic_info def set_demographic_info
return if user.blank? return if user.blank?