module ErpBaseErpSvcs::Extensions::ActiveRecord::IsContactMechanism::InstanceMethods
Public Instance Methods
add_contact_purpose(contact_purpose)
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 56 def add_contact_purpose(contact_purpose) unless contact_purpose.is_a?(ContactPurpose) contact_purpose = ContactPurpose.iid(contact_purpose) end # don't add the contact purpose if its already there unless contact_purpose_iids.include?(contact_purpose.internal_identifier) contact.contact_purposes << contact_purpose contact.save end end
contact_purpose_iids()
click to toggle source
return all contact purpose iids in one comma separated string
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 69 def contact_purpose_iids contact.contact_purposes.collect(&:internal_identifier).join(',') end
contact_purposes()
click to toggle source
return all contact purposes
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 74 def contact_purposes contact.contact_purposes end
contact_purposes_to_s()
click to toggle source
return all contact purposes in one comma separated string
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 52 def contact_purposes_to_s contact.contact_purposes.collect(&:description).join(', ') end
destroy_contact()
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 78 def destroy_contact self.contact.destroy unless self.contact.nil? end
initialize_contact()
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 82 def initialize_contact if self.new_record? and self.contact.nil? self.contact = Contact.new self.contact.description = self.description end end
save_contact()
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/is_contact_mechanism.rb, line 47 def save_contact self.contact.save end