insteadInstead of:
if first_name.blank? && last_name.blank?
'Name: unknown'
else
first_name + ' ' + last_name
end
if first_name.blank? && last_name.blank? 'Name: unknown' else first_name + ' ' + last_name end
oneOne who prefers onelinersone-liners could do:
"#{first_name} #{last_name}".strip.empty? ? "Name: unknown" : "#{first_name} #{last_name}"
whats more:
it preferFurthermore, it's better to move these helper methodssuch code to a helper method or a decorator using https://github.com/drapergem/draper