mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 17:23:34 +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)
|
||||
end
|
||||
|
||||
### CREATE ###
|
||||
|
||||
def attach_objects(ph, frame)
|
||||
attach_owner_contact(ph[:registrant])
|
||||
attach_contacts(self.class.parse_contacts_from_frame(frame))
|
||||
|
@ -120,17 +122,7 @@ class Domain < ActiveRecord::Base
|
|||
self.nameservers.build(attrs)
|
||||
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
|
||||
### RENEW ###
|
||||
|
||||
def renew(cur_exp_date, period, unit='y')
|
||||
# TODO Check how much time before domain exp date can it be renewed
|
||||
|
@ -147,6 +139,18 @@ class Domain < ActiveRecord::Base
|
|||
save
|
||||
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
|
||||
return unless period.present?
|
||||
if period_unit == 'd'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue