mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Add countries gem
This commit is contained in:
parent
864c451a61
commit
6aaf89593e
5 changed files with 17 additions and 5 deletions
|
@ -8,10 +8,13 @@ class Address < ActiveRecord::Base
|
|||
]
|
||||
|
||||
belongs_to :contact
|
||||
belongs_to :country_deprecated, foreign_key: "country_id"
|
||||
|
||||
has_paper_trail class_name: 'AddressVersion'
|
||||
|
||||
def country
|
||||
Country.new(country_code)
|
||||
end
|
||||
|
||||
class << self
|
||||
# def validate_postal_info_types(parsed_frame)
|
||||
# errors, used = [], []
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Registrar < ActiveRecord::Base
|
||||
belongs_to :country_deprecated, foreign_key: "country_id"
|
||||
has_many :domains, dependent: :restrict_with_error
|
||||
has_many :contacts, dependent: :restrict_with_error
|
||||
has_many :api_users, dependent: :restrict_with_error
|
||||
|
@ -23,6 +22,10 @@ class Registrar < ActiveRecord::Base
|
|||
name
|
||||
end
|
||||
|
||||
def country
|
||||
Country.new(country_code)
|
||||
end
|
||||
|
||||
class << self
|
||||
def search_by_query(query)
|
||||
res = search(name_or_reg_no_cont: query).result
|
||||
|
|
|
@ -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