Class: Contact

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/contact.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject

rather than carry our own description for the abstract -contact-, we’ll delegate that call to the implementer of the -contact_mechanism- interface



13
14
15
# File 'app/models/contact.rb', line 13

def description
  @description = contact_mechanism.description
end

#description=(d) ⇒ Object



17
18
19
# File 'app/models/contact.rb', line 17

def description=(d)
  @description=d
end

#is_primary?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/contact.rb', line 44

def is_primary?
  self.is_primary
end

#partyObject



21
22
23
24
25
26
27
# File 'app/models/contact.rb', line 21

def party
  if self.contact_record_type == 'Party'
    self.contact_record
  else
    nil
  end
end

#party=(party) ⇒ Object



29
30
31
# File 'app/models/contact.rb', line 29

def party=(party)
  self.contact_record = party
end

#purposeObject

return first contact purpose



49
50
51
# File 'app/models/contact.rb', line 49

def purpose
  contact_purposes.first.description
end

#purposesObject

return all contact purposes as an array



54
55
56
57
58
59
60
61
# File 'app/models/contact.rb', line 54

def purposes
  p = []
  contact_purposes.each do |cp|
    p << cp.description
  end

  return p
end

#summary_lineObject



40
41
42
# File 'app/models/contact.rb', line 40

def summary_line
  "#{contact_mechanism.summary_line}"
end

#to_labelObject

delegate our need to provide a label to scaffolds to the implementer of the -contact_mechanism- interface.



36
37
38
# File 'app/models/contact.rb', line 36

def to_label
  "#{contact_mechanism.description}"
end