Class: Contact
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Contact
- Defined in:
- app/models/contact.rb
Instance Method Summary collapse
-
#description ⇒ Object
rather than carry our own description for the abstract -contact-, we’ll delegate that call to the implementer of the -contact_mechanism- interface.
- #description=(d) ⇒ Object
- #is_primary? ⇒ Boolean
- #party ⇒ Object
- #party=(party) ⇒ Object
-
#purpose ⇒ Object
return first contact purpose.
-
#purposes ⇒ Object
return all contact purposes as an array.
- #summary_line ⇒ Object
-
#to_label ⇒ Object
delegate our need to provide a label to scaffolds to the implementer of the -contact_mechanism- interface.
Instance Method Details
#description ⇒ Object
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
44 45 46 |
# File 'app/models/contact.rb', line 44 def is_primary? self.is_primary end |
#party ⇒ Object
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 |
#purpose ⇒ Object
return first contact purpose
49 50 51 |
# File 'app/models/contact.rb', line 49 def purpose contact_purposes.first.description end |
#purposes ⇒ Object
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_line ⇒ Object
40 41 42 |
# File 'app/models/contact.rb', line 40 def summary_line "#{contact_mechanism.summary_line}" end |
#to_label ⇒ Object
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 |