1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/models/passport.rb

23 lines
593 B
Ruby
Raw Normal View History

2018-11-29 20:19:38 -05:00
# frozen_string_literal: true
class Passport < ApplicationRecord
2018-11-29 21:46:38 -05:00
enum sex: %i[male female]
2018-11-29 20:19:38 -05:00
2018-11-29 22:02:04 -05:00
has_one_attached :image
2018-11-29 20:19:38 -05:00
validates :surname, presence: true
validates :given_name, presence: true
validates :sex, presence: true
validates :date_of_birth, presence: true
validates :place_of_birth, presence: true
validates :series, presence: true
validates :number, presence: true
validates :issued_by, presence: true
validates :unit_code, presence: true
validates :date_of_issue, presence: true
before_validation do
self.patronymic = nil if patronymic.blank?
end
end