Sha256: bc13e010dfc2caee57d4fb69926ee9dd959e0111e5b167e15fe0bcbde3534c95
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true require_dependency "mr_common/application_record" module MrCommon class Registration < ApplicationRecord include MrCommon::CSVExportable validates :first_name, presence: true validates :last_name, presence: true validates :email, presence: true, format: Pattern.email validates :company_name, presence: true validates :telephone, presence: true, format: Pattern.phone_number validates :job_title, presence: true validates :contact_via_email, inclusion: [true, false] validates :contact_via_phone, inclusion: [true, false] validate :telephone_length private def telephone_length digits = telephone.gsub(/\D+/, "") errors.add(:telephone, "must be longer") if digits.length < 7 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mr_common-2.1.0 | app/models/mr_common/registration.rb |
mr_common-2.0.0 | app/models/mr_common/registration.rb |