Sha256: 7c466fb863789bce5e7f48324883325aa771ee5bf0ded163b2e9ee1a93621e38

Contents?: true

Size: 1.21 KB

Versions: 38

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    module Census
      class Datum < ApplicationRecord
        include Decidim::RecordEncryptor

        encrypt_attribute :full_name, type: :string
        encrypt_attribute :full_address, type: :string
        encrypt_attribute :postal_code, type: :string
        encrypt_attribute :mobile_phone_number, type: :string
        encrypt_attribute :email, type: :string

        belongs_to :dataset, counter_cache: :data_count,
                             foreign_key: "decidim_votings_census_dataset_id",
                             class_name: "Decidim::Votings::Census::Dataset"
        belongs_to :ballot_style, optional: true,
                                  class_name: "Decidim::Votings::BallotStyle",
                                  foreign_key: :decidim_votings_ballot_style_id

        validates :full_name,
                  :full_address,
                  :postal_code,
                  :hashed_in_person_data,
                  :hashed_check_data,
                  presence: true

        validates :hashed_in_person_data, uniqueness: { scope: :dataset }
        validates :hashed_check_data, uniqueness: { scope: :dataset }
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.9 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.3 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.8 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.2 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.7 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.1 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.6 app/models/decidim/votings/census/datum.rb
decidim-elections-0.26.10 app/models/decidim/votings/census/datum.rb
decidim-elections-0.26.9 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.0 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.5 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.0.rc5 app/models/decidim/votings/census/datum.rb
decidim-elections-0.28.0.rc4 app/models/decidim/votings/census/datum.rb
decidim-elections-0.26.8 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.4 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.3 app/models/decidim/votings/census/datum.rb
decidim-elections-0.26.7 app/models/decidim/votings/census/datum.rb
decidim-elections-0.26.5 app/models/decidim/votings/census/datum.rb
decidim-elections-0.27.2 app/models/decidim/votings/census/datum.rb