This may work as well: contact_line = "#{contact.contact_type.try(:name)}"