1
0
Fork 0

Use GoodSmallTextValidator

This commit is contained in:
Alex Kotov 2019-09-30 16:46:38 +05:00
parent 2f114c1651
commit 25dea68be5
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -3,8 +3,6 @@
class Passport < ApplicationRecord
include RequiredNameable
FORMAT_RE = /\A[^[:space:]]+(.*[^[:space:]]+)?\z/.freeze
################
# Associations #
################
@ -16,84 +14,25 @@ class Passport < ApplicationRecord
# Validations #
###############
validates :series, presence: true
validates :number, presence: true
validates :issued_by, presence: true
validates :unit_code, 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
validates :zip_code,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :town_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :town_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :settlement_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :settlement_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :district_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :district_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :street_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :street_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :residence_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :residence_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :building_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :building_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :apartment_type,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :apartment_name,
allow_nil: true,
length: { in: 1..255 },
format: { with: FORMAT_RE }
validates :zip_code, allow_nil: true, good_small_text: true
validates :town_type, allow_nil: true, good_small_text: true
validates :town_name, allow_nil: true, good_small_text: true
validates :settlement_type, allow_nil: true, good_small_text: true
validates :settlement_name, allow_nil: true, good_small_text: true
validates :district_type, allow_nil: true, good_small_text: true
validates :district_name, allow_nil: true, good_small_text: true
validates :street_type, allow_nil: true, good_small_text: true
validates :street_name, allow_nil: true, good_small_text: true
validates :residence_type, allow_nil: true, good_small_text: true
validates :residence_name, allow_nil: true, good_small_text: true
validates :building_type, allow_nil: true, good_small_text: true
validates :building_name, allow_nil: true, good_small_text: true
validates :apartment_type, allow_nil: true, good_small_text: true
validates :apartment_name, allow_nil: true, good_small_text: true
end