diff --git a/app/models/contact.rb b/app/models/contact.rb index 31c7ed517..d18959208 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -4,8 +4,8 @@ class Contact < ActiveRecord::Base include EppErrors - has_one :local_address - has_one :international_address + has_one :local_address, dependent: :destroy + has_one :international_address, dependent: :destroy has_one :disclosure, class_name: 'ContactDisclosure' has_many :domain_contacts @@ -96,7 +96,6 @@ class Contact < ActiveRecord::Base # should use only in transaction def destroy_and_clean - clean_up_address if relations_with_domain? errors.add(:domains, :exist) @@ -159,8 +158,4 @@ class Contact < ActiveRecord::Base end private - - def clean_up_address - address.destroy if address - end end