Sha256: b2ef0331c7183b8b029986980d2b6fdbb4a31ae5515b56f642bbc9530717a96a

Contents?: true

Size: 473 Bytes

Versions: 23

Compression:

Stored size: 473 Bytes

Contents

module EgovUtils
  class RegistrationRequest < ApplicationRecord
    validates :mail, :firstname, :lastname, :organization, :supervisor_email,
              :supervisor_name, presence: true
    validate :check_user_already_exists!

    attr_accessor :roles, :group_ids

    def fullname
      "#{firstname} #{lastname}"
    end

    private

    def check_user_already_exists!
      return unless User.find_by(mail: mail)

      errors.add(:mail, :taken)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha15 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha14 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha13 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha12 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha11 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha10 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha9 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha8 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha7 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha6 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha5 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha4 app/models/egov_utils/registration_request.rb
egov_utils-1.4.5 app/models/egov_utils/registration_request.rb
egov_utils-1.4.4 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha3 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha2 app/models/egov_utils/registration_request.rb
egov_utils-1.5.0.alpha1 app/models/egov_utils/registration_request.rb
egov_utils-1.4.3 app/models/egov_utils/registration_request.rb
egov_utils-1.4.2 app/models/egov_utils/registration_request.rb