115040781-legal_doc_check_and_save

This commit is contained in:
Stas 2016-03-24 12:01:10 +02:00
parent 431eaf5439
commit 4e51adb08e

View file

@ -335,9 +335,19 @@ class Contact < ActiveRecord::Base
errors.add(:domains, :exist) errors.add(:domains, :exist)
return false return false
end end
if doc = Epp::Contact.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
self.legal_document_id = doc.id
if legal_document_data
doc = LegalDocument.create(
documentable_type: Contact,
document_type: legal_document_data[:type],
body: legal_document_data[:body]
)
self.legal_documents = [doc]
self.legal_document_id = doc.id
self.save
end end
destroy destroy
end end