Contact change notification email content update #2558

This commit is contained in:
Priit Tark 2015-06-03 10:06:40 +03:00
parent 941538b924
commit 410914e16e
4 changed files with 53 additions and 11 deletions

View file

@ -7,6 +7,7 @@ class Contact < ActiveRecord::Base
has_many :domains, through: :domain_contacts
has_many :statuses, class_name: 'ContactStatus', dependent: :destroy
has_many :legal_documents, as: :documentable
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
accepts_nested_attributes_for :legal_documents
@ -184,4 +185,21 @@ class Contact < ActiveRecord::Base
errors.add(:ident, :invalid_country_code)
end
end
def related_domain_descriptions
@desc = {}
registrant_domains.each do |dom|
@desc[dom.name] ||= []
@desc[dom.name] << :registrant
end
domain_contacts.each do |dc|
@desc[dc.domain.name] ||= []
@desc[dc.domain.name] << dc.name.downcase.to_sym
@desc[dc.domain.name] = @desc[dc.domain.name].compact
end
@desc
end
end