mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
story#115762063 - children log method doesn't save ids marked for destruction
This commit is contained in:
parent
da0f11d47f
commit
f873b14214
1 changed files with 10 additions and 6 deletions
|
@ -725,14 +725,18 @@ class Domain < ActiveRecord::Base
|
|||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
|
||||
|
||||
# small optimization that we'are using to_a if it was done already
|
||||
# otherwise just getting ids
|
||||
def children_log
|
||||
log = HashWithIndifferentAccess.new
|
||||
log[:admin_contacts] = admin_contact_ids
|
||||
log[:tech_contacts] = tech_contact_ids
|
||||
log[:nameservers] = nameserver_ids
|
||||
types = %i(admin_contacts tech_contacts nameservers dnskeys domain_statuses)
|
||||
|
||||
types.each do |rel|
|
||||
ids = send(rel).loaded? ? send(rel).reject(&:marked_for_destruction?).map(&:id) : send(rel).pluck(:id)
|
||||
log[rel] = ids
|
||||
end
|
||||
log[:registrant] = [registrant_id]
|
||||
log[:domain_statuses]= domain_status_ids
|
||||
log[:dnskeys] = dnskey_ids
|
||||
log
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue