mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Add countries gem
This commit is contained in:
parent
864c451a61
commit
6aaf89593e
5 changed files with 17 additions and 5 deletions
|
@ -6,8 +6,6 @@ class User < ActiveRecord::Base
|
|||
# After activisation, system should require to change temp password.
|
||||
# TODO: Estonian id validation
|
||||
|
||||
belongs_to :country_deprecated, foreign_key: "country_id"
|
||||
|
||||
validates :username, :password, presence: true
|
||||
validates :identity_code, uniqueness: true, allow_blank: true
|
||||
validates :identity_code, presence: true, if: -> { country.iso == 'EE' }
|
||||
|
@ -21,6 +19,10 @@ class User < ActiveRecord::Base
|
|||
username
|
||||
end
|
||||
|
||||
def country
|
||||
Country.new(country_code)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_identity_code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue