Sha256: 1e44eee8724d8545b0ab1c17c31cec76943d647f618fc001162026d13b9809c2
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 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 # 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
6 entries across 6 versions & 1 rubygems