mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Added some missing model specs + PaperTrail session fix
This commit is contained in:
parent
c248a957a6
commit
a637eb5e01
39 changed files with 1447 additions and 845 deletions
|
@ -7,12 +7,13 @@ class User < ActiveRecord::Base
|
|||
# After activisation, system should require to change temp password.
|
||||
# TODO: Estonian id validation
|
||||
|
||||
validates :username, :password, presence: true
|
||||
validates :username, :password, :country_code, presence: true
|
||||
validates :identity_code, uniqueness: true, allow_blank: true
|
||||
validates :identity_code, presence: true, if: -> { country.alpha2 == 'EE' }
|
||||
validates :email, presence: true, if: -> { country.alpha2 != 'EE' }
|
||||
validates :identity_code, presence: true, if: -> { country_code == 'EE' }
|
||||
validates :email, presence: true, if: -> { country_code != 'EE' }
|
||||
|
||||
validate :validate_identity_code
|
||||
belongs_to :country_deprecated, foreign_key: :country_id
|
||||
|
||||
ROLES = %w(user customer_service admin)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue