From 959dfc6c26e9f3e4c9f7187f9505dac351a57e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Fri, 19 Sep 2014 12:59:50 +0300 Subject: [PATCH] Tidied up contact model a bit --- app/models/contact.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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