Minor fixes

This commit is contained in:
Martin Lensment 2014-09-22 20:10:52 +03:00
parent 03da7e7bc3
commit f860a8937f
3 changed files with 7 additions and 5 deletions

View file

@ -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

View file

@ -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?

View file

@ -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