mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 16:39:55 +02:00
Add countries gem
This commit is contained in:
parent
864c451a61
commit
6aaf89593e
5 changed files with 17 additions and 5 deletions
2
Gemfile
2
Gemfile
|
@ -52,7 +52,7 @@ gem 'daemons', '~> 1.1.9' # process delayed jobs
|
|||
gem 'newrelic_rpm', '~> 3.9.9.275'
|
||||
|
||||
# country listing
|
||||
# gem 'countries', '~> 0.10.0'
|
||||
gem 'countries', '~> 0.10.0'
|
||||
|
||||
group :development do
|
||||
# dev tools
|
||||
|
|
|
@ -106,6 +106,9 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.8.0)
|
||||
countries (0.10.0)
|
||||
currencies (~> 0.4.2)
|
||||
currencies (0.4.2)
|
||||
daemons (1.1.9)
|
||||
database_cleaner (1.3.0)
|
||||
debug_inspector (0.0.2)
|
||||
|
@ -439,6 +442,7 @@ DEPENDENCIES
|
|||
cancancan (~> 1.9.2)
|
||||
capybara (~> 2.4.1)
|
||||
coffee-rails (~> 4.1.0)
|
||||
countries (~> 0.10.0)
|
||||
daemons (~> 1.1.9)
|
||||
database_cleaner (~> 1.3.0)
|
||||
delayed_job_active_record (~> 4.0.3)
|
||||
|
|
|
@ -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