lib/pupa/models/concerns/contactable.rb in pupa-0.0.10 vs lib/pupa/models/concerns/contactable.rb in pupa-0.0.11
- old
+ new
@@ -16,11 +16,11 @@
# Sets the contact details.
#
# @param [Array] contact_details a list of contact details
def contact_details=(contact_details)
- @contact_details = ContactDetailList.new(contact_details)
+ @contact_details = ContactDetailList.new(symbolize_keys(contact_details))
end
# Adds a contact detail.
#
# @param [String] type a type of medium, e.g. "fax" or "email"
@@ -29,10 +29,10 @@
def add_contact_detail(type, value, note: nil)
data = {type: type, value: value}
if note
data[:note] = note
end
- if type && value
+ if type.present? && value.present?
@contact_details << data
end
end
end
end