Change domain registrar_id and registrant_id to NOT NULL

#480
This commit is contained in:
Artur Beljajev 2017-06-06 19:16:46 +03:00
parent b20e31f3c8
commit 930a59ae67
4 changed files with 34 additions and 17 deletions

View file

@ -19,8 +19,8 @@ class Domain < ActiveRecord::Base
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
# TODO: most inputs should be trimmed before validatation, probably some global logic?
belongs_to :registrar
belongs_to :registrant
belongs_to :registrar, required: true
belongs_to :registrant, required: true
# TODO: should we user validates_associated :registrant here?
has_many :admin_domain_contacts
@ -104,8 +104,7 @@ class Domain < ActiveRecord::Base
validates :name_dirty, domain_name: true, uniqueness: true
validates :puny_label, length: { maximum: 63 }
validates :period, numericality: { only_integer: true }
validates :registrant, :registrar, presence: true
validates :period, presence: true, numericality: { only_integer: true }
validate :validate_reservation
def validate_reservation