Skip to content

Commit

Permalink
Merge pull request #707 from DEFRA/fix/area-identifier-validation
Browse files Browse the repository at this point in the history
refactoring identifier validation rules
  • Loading branch information
brujeo authored Sep 28, 2023
2 parents c5d507b + 0b39cc1 commit 99c59f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/pafs_core/area.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class Area < ApplicationRecord

validates :name, :area_type, presence: true
validates :name, uniqueness: true
validates :identifier, presence: true, if: :rma? || :authority?, unless: :skip_identifier_validation
validates :identifier, uniqueness: true, if: :rma? || :authority?, unless: :skip_identifier_validation
validates :identifier, presence: true, if: -> { rma? || authority? }, unless: :skip_identifier_validation
validates :identifier, uniqueness: true, if: -> { rma? || authority? }, unless: :skip_identifier_validation
validate :parentage
validates :area_type, inclusion: { in: AREA_TYPES }
validates :sub_type, presence: true, if: :rma?
Expand Down

0 comments on commit 99c59f0

Please sign in to comment.