Module: ErpBaseErpSvcs::Extensions::ActiveRecord::HasContact::InstanceMethods

Defined in:
lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb

Instance Method Summary collapse

Instance Method Details

#contact_purpose_iidsObject

return all contact purpose iids in one comma separated string



44
45
46
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 44

def contact_purpose_iids
  contact.contact_purposes.collect(&:internal_identifier).join(',')
end

#contact_purposesObject

return all contact purposes



49
50
51
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 49

def contact_purposes
  contact.contact_purposes
end

#contact_purposes_to_sObject

return all contact purposes in one comma separated string



39
40
41
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 39

def contact_purposes_to_s
  contact.contact_purposes.collect(&:description).join(', ')
end

#destroy_contactObject



53
54
55
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 53

def destroy_contact
 self.contact.destroy unless self.contact.nil?
end

#initialize_contactObject



57
58
59
60
61
62
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 57

def initialize_contact
  if self.new_record? and self.contact.nil?
    self.contact = Contact.new
    self.contact.description = self.description
  end
end

#save_contactObject



34
35
36
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_contact.rb', line 34

def save_contact
					  self.contact.save
end