Sha256: 2276c492c0fbcf9e7255a315917d8e5fbec29d2f8c1e5f1d4b2ac3a5b242e42f

Contents?: true

Size: 846 Bytes

Versions: 8

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    module Census
      module Admin
        # A form object used to create a datum record (participant) for
        # a voting census
        class DatumForm < Form
          mimic :datum

          include Decidim::Votings::Census::CheckFields

          attribute :full_name, String
          attribute :full_address, String
          attribute :mobile_phone_number, String
          attribute :email, String
          attribute :ballot_style_code, String

          validates :birthdate, format: { with: /\A\d{8}\z/ }

          validates :full_name,
                    :full_address,
                    :birthdate,
                    presence: true

          def ballot_style_code
            @ballot_style_code&.upcase
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-elections-0.26.10 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.9 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.8 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.7 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.5 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.4 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.3 app/forms/decidim/votings/census/admin/datum_form.rb
decidim-elections-0.26.2 app/forms/decidim/votings/census/admin/datum_form.rb