mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Restructure
This commit is contained in:
parent
d555f70631
commit
a7f698a0f4
1 changed files with 15 additions and 11 deletions
|
@ -48,6 +48,8 @@ class Domain < ActiveRecord::Base
|
||||||
write_attribute(:name_dirty, value)
|
write_attribute(:name_dirty, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
### CREATE ###
|
||||||
|
|
||||||
def attach_objects(ph, frame)
|
def attach_objects(ph, frame)
|
||||||
attach_owner_contact(ph[:registrant])
|
attach_owner_contact(ph[:registrant])
|
||||||
attach_contacts(self.class.parse_contacts_from_frame(frame))
|
attach_contacts(self.class.parse_contacts_from_frame(frame))
|
||||||
|
@ -120,17 +122,7 @@ class Domain < ActiveRecord::Base
|
||||||
self.nameservers.build(attrs)
|
self.nameservers.build(attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
### VALIDATIONS ###
|
### RENEW ###
|
||||||
|
|
||||||
def validate_nameservers_count
|
|
||||||
unless nameservers.length.between?(1, 13)
|
|
||||||
errors.add(:nameservers, :out_of_range, {min: 1, max: 13})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def validate_admin_contacts_count
|
|
||||||
errors.add(:admin_contacts, :blank) if admin_contacts.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
def renew(cur_exp_date, period, unit='y')
|
def renew(cur_exp_date, period, unit='y')
|
||||||
# TODO Check how much time before domain exp date can it be renewed
|
# TODO Check how much time before domain exp date can it be renewed
|
||||||
|
@ -147,6 +139,18 @@ class Domain < ActiveRecord::Base
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
### VALIDATIONS ###
|
||||||
|
|
||||||
|
def validate_nameservers_count
|
||||||
|
unless nameservers.length.between?(1, 13)
|
||||||
|
errors.add(:nameservers, :out_of_range, {min: 1, max: 13})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def validate_admin_contacts_count
|
||||||
|
errors.add(:admin_contacts, :blank) if admin_contacts.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def validate_period
|
def validate_period
|
||||||
return unless period.present?
|
return unless period.present?
|
||||||
if period_unit == 'd'
|
if period_unit == 'd'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue