From 114f15d4ea8469527bbb0d119074790c7e011dd2 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 27 Feb 2018 09:58:51 +0200 Subject: [PATCH] Add association `inverse_of` #661 --- app/models/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 54dfe608e..5cc81723f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -40,7 +40,7 @@ class Domain < ActiveRecord::Base has_many :contacts, through: :domain_contacts, source: :contact has_many :admin_contacts, through: :admin_domain_contacts, source: :contact has_many :tech_contacts, through: :tech_domain_contacts, source: :contact - has_many :nameservers, dependent: :destroy + has_many :nameservers, dependent: :destroy, inverse_of: :domain accepts_nested_attributes_for :nameservers, allow_destroy: true, reject_if: proc { |attrs| attrs[:hostname].blank? }