mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Refactor country
This commit is contained in:
parent
195aa4a890
commit
b86e2d1edb
3 changed files with 8 additions and 8 deletions
|
@ -9,8 +9,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
validates :username, :password, presence: true
|
||||
validates :identity_code, uniqueness: true, allow_blank: true
|
||||
validates :identity_code, presence: true, if: -> { country.iso == 'EE' }
|
||||
validates :email, presence: true, if: -> { country.iso != 'EE' }
|
||||
validates :identity_code, presence: true, if: -> { country.alpha2 == 'EE' }
|
||||
validates :email, presence: true, if: -> { country.alpha2 != 'EE' }
|
||||
|
||||
validate :validate_identity_code
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue