diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 95c537ee9..8fb900539 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -81,7 +81,7 @@ class Admin::DomainsController < ApplicationController def build_associations @domain.nameservers.build if @domain.nameservers.empty? @domain.domain_contacts.build if @domain.domain_contacts.empty? - @domain.domain_statuses.build if @domain.domain_contacts.empty? + @domain.domain_statuses.build if @domain.domain_statuses.empty? end def verify_deletion diff --git a/app/models/domain.rb b/app/models/domain.rb index e0f0dd13c..39c1974cd 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,6 +1,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? + paginates_per 10 # just for showoff + belongs_to :registrar belongs_to :owner_contact, class_name: 'Contact' @@ -41,7 +43,7 @@ class Domain < ActiveRecord::Base validate :validate_period validate :validate_nameservers_count - validate :validate_admin_contacts_count, if: :new_record? + validate :validate_admin_contacts_count validate :validate_nameservers_uniqueness, if: :new_record? validate :validate_tech_contacts_uniqueness, if: :new_record? validate :validate_admin_contacts_uniqueness, if: :new_record? diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index 35e11e57c..e11883d87 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -43,13 +43,13 @@ describe Domain do d = Domain.new expect(d.valid?).to be false - expect(d.errors.messages).to match_array({ - name: ['is missing'], period: ['is not a number'], owner_contact: ['Registrant is missing'], admin_contacts: ['Admin contacts count must be between 1 - infinity'], - nameservers: ['Nameservers count must be between 1-13'] + nameservers: ['Nameservers count must be between 1-13'], + registrar: ['Registrar is missing'], + period: ['Period is not a number'] }) sg = SettingGroup.domain_validation