mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Migrate country id-s to country codes
This commit is contained in:
parent
ea6bdc19f9
commit
864c451a61
7 changed files with 41 additions and 11 deletions
|
@ -8,7 +8,7 @@ class Address < ActiveRecord::Base
|
|||
]
|
||||
|
||||
belongs_to :contact
|
||||
belongs_to :country
|
||||
belongs_to :country_deprecated, foreign_key: "country_id"
|
||||
|
||||
has_paper_trail class_name: 'AddressVersion'
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class Country < ActiveRecord::Base
|
||||
class CountryDeprecated < ActiveRecord::Base
|
||||
self.table_name = "countries"
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class Registrar < ActiveRecord::Base
|
||||
belongs_to :country
|
||||
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
|
||||
|
|
|
@ -6,7 +6,7 @@ class User < ActiveRecord::Base
|
|||
# After activisation, system should require to change temp password.
|
||||
# TODO: Estonian id validation
|
||||
|
||||
belongs_to :country
|
||||
belongs_to :country_deprecated, foreign_key: "country_id"
|
||||
|
||||
validates :username, :password, presence: true
|
||||
validates :identity_code, uniqueness: true, allow_blank: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue