Use GoodSmallTextValidator
This commit is contained in:
parent
25dea68be5
commit
779bc0a704
4 changed files with 6 additions and 35 deletions
|
@ -1,8 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ContactNetwork < ApplicationRecord
|
||||
FORMAT_RE = /\A[^[:space:]]+(.*[^[:space:]]+)?\z/.freeze
|
||||
|
||||
################
|
||||
# Associations #
|
||||
################
|
||||
|
@ -13,15 +11,9 @@ class ContactNetwork < ApplicationRecord
|
|||
# Validations #
|
||||
###############
|
||||
|
||||
validates :codename,
|
||||
presence: true,
|
||||
codename: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
validates :codename, codename: true, uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
length: { in: 1..255 },
|
||||
format: FORMAT_RE
|
||||
validates :name, good_small_text: true
|
||||
|
||||
###########
|
||||
# Methods #
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RegionalOffice < ApplicationRecord
|
||||
FORMAT_RE = /\A[^[:space:]]+(.*[^[:space:]]+)?\z/.freeze
|
||||
|
||||
################
|
||||
# Associations #
|
||||
################
|
||||
|
@ -15,9 +13,5 @@ class RegionalOffice < ApplicationRecord
|
|||
|
||||
validates :federal_subject, uniqueness: true
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
uniqueness: true,
|
||||
length: { in: 1..255 },
|
||||
format: { with: FORMAT_RE }
|
||||
validates :name, good_small_text: true, uniqueness: true
|
||||
end
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RelationStatus < ApplicationRecord
|
||||
FORMAT_RE = /\A[^[:space:]]+(.*[^[:space:]]+)?\z/.freeze
|
||||
|
||||
################
|
||||
# Associations #
|
||||
################
|
||||
|
@ -17,16 +15,9 @@ class RelationStatus < ApplicationRecord
|
|||
# Validations #
|
||||
###############
|
||||
|
||||
validates :codename,
|
||||
presence: true,
|
||||
codename: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
validates :codename, codename: true, uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
length: { in: 1..255 },
|
||||
format: FORMAT_RE,
|
||||
uniqueness: true
|
||||
validates :name, good_small_text: true, uniqueness: true
|
||||
|
||||
###########
|
||||
# Methods #
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RelationTransition < ApplicationRecord
|
||||
FORMAT_RE = /\A[^[:space:]]+(.*[^[:space:]]+)?\z/.freeze
|
||||
|
||||
################
|
||||
# Associations #
|
||||
################
|
||||
|
@ -19,11 +17,7 @@ class RelationTransition < ApplicationRecord
|
|||
# Validations #
|
||||
###############
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
length: { in: 1..255 },
|
||||
format: FORMAT_RE,
|
||||
uniqueness: true
|
||||
validates :name, good_small_text: true, uniqueness: true
|
||||
|
||||
validate :statuses_are_not_equal
|
||||
|
||||
|
|
Reference in a new issue