mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
Tidied up contact model a bit
This commit is contained in:
parent
aecb919610
commit
959dfc6c26
1 changed files with 2 additions and 7 deletions
|
@ -4,8 +4,8 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
has_one :local_address
|
has_one :local_address, dependent: :destroy
|
||||||
has_one :international_address
|
has_one :international_address, dependent: :destroy
|
||||||
has_one :disclosure, class_name: 'ContactDisclosure'
|
has_one :disclosure, class_name: 'ContactDisclosure'
|
||||||
|
|
||||||
has_many :domain_contacts
|
has_many :domain_contacts
|
||||||
|
@ -96,7 +96,6 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
# should use only in transaction
|
# should use only in transaction
|
||||||
def destroy_and_clean
|
def destroy_and_clean
|
||||||
clean_up_address
|
|
||||||
|
|
||||||
if relations_with_domain?
|
if relations_with_domain?
|
||||||
errors.add(:domains, :exist)
|
errors.add(:domains, :exist)
|
||||||
|
@ -159,8 +158,4 @@ class Contact < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def clean_up_address
|
|
||||||
address.destroy if address
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue