refactoring

This commit is contained in:
Oleg Hasjanov 2021-05-28 14:46:58 +03:00
parent a8d1d66c3a
commit 6144692713

View file

@ -67,7 +67,8 @@
- else
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
- if contact.nil? && ver = Version::ContactVersion.where(item_id: domain.registrant_id).last
- result = ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last })&.(*Contact&.column_names)
- merged_obj = ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last }
- result = ver.object.to_h.merge(merged_obj)&.slice(*Contact&.column_names)
- contact = Contact.new(result)
= contact.try(:name)
= " ".html_safe