Sha256: 2c462ce21d308e0b0252fafa1fdccb2fb0bfd9c41da2fbeb077709ff734abcee
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
class Contact < ActiveRecord::Base attr_protected :created_at, :updated_at has_and_belongs_to_many :contact_purposes belongs_to :party belongs_to :contact_mechanism, :polymorphic => true, :dependent => :destroy #rather than carry our own description for the abstract -contact-, we'll #delegate that call to the implementer of the -contact_mechanism- interface def description @description = contact_mechanism.description end def description=(d) @description=d end #delegate our need to provide a label to scaffolds to the implementer of #the -contact_mechanism- interface. def to_label "#{contact_mechanism.description}" end def summary_line "#{contact_mechanism.summary_line}" end def is_primary? self.is_primary end # return first contact purpose def purpose contact_purposes.first.description end # return all contact purposes as an array def purposes p = [] contact_purposes.each do |cp| p << cp.description end return p end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
erp_base_erp_svcs-4.0.0 | app/models/contact.rb |