Tidied up contact model a bit

This commit is contained in:
Andres Keskküla 2014-09-19 12:59:50 +03:00
parent aecb919610
commit 959dfc6c26

View file

@ -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