Create domain works with nested attributes

This commit is contained in:
Martin Lensment 2015-02-16 11:45:27 +02:00
parent 037cb57e00
commit 27d19ad237
4 changed files with 124 additions and 6 deletions

View file

@ -41,6 +41,7 @@ class Domain < ActiveRecord::Base
reject_if: proc { |attrs| attrs[:public_key].blank? }
has_many :legal_documents, as: :documentable
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
delegate :code, to: :owner_contact, prefix: true
delegate :email, to: :owner_contact, prefix: true

View file

@ -2,6 +2,8 @@
class Epp::EppDomain < Domain
include EppErrors
accepts_nested_attributes_for :nameservers
def epp_code_map # rubocop:disable Metrics/MethodLength
{
'2002' => [
@ -58,6 +60,21 @@ class Epp::EppDomain < Domain
}
end
def self.new_from_epp(domain_params)
new(domain_params)
end
def parse_and_attach_domain_dependencies(parsed_frame)
attach_owner_contact(self.class.parse_owner_contact_from_frame(parsed_frame))
attach_contacts(self.class.parse_contacts_from_frame(parsed_frame))