Skip to content

Commit

Permalink
Validate unique user_id at the Person model level
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 17, 2024
1 parent 30f85c5 commit f3ba87f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Person < ApplicationRecord
validates :email, allow_blank: true, length: {maximum: 105},
format: {with: VALID_EMAIL_REGEX}
validates :phone, allow_blank: true, format: {with: VALID_PHONE_REGEX}
validates :user_id, unique: true, allow_blank: true
validates_with BirthdateValidator

# This method needs to extract ids and run a new search to remain compatible
Expand Down

0 comments on commit f3ba87f

Please sign in to comment.