lib/pupa/models/concerns/contactable.rb in pupa-0.0.9 vs lib/pupa/models/concerns/contactable.rb in pupa-0.0.10

- old
+ new

@@ -7,10 +7,15 @@ included do attr_reader :contact_details dump :contact_details end + def initialize(*args) + @contact_details = ContactDetailList.new + super + end + # Sets the contact details. # # @param [Array] contact_details a list of contact details def contact_details=(contact_details) @contact_details = ContactDetailList.new(contact_details) @@ -25,10 +30,10 @@ data = {type: type, value: value} if note data[:note] = note end if type && value - (@contact_details ||= ContactDetailList.new) << data + @contact_details << data end end end end end