<% @messages.each do |message| %> <%= message.sender&.try(:available_name) || message.sender&.name || '' %> <% if message.content %> <%= message.content %> <% end %> <% if message.attachments %> <% message.attachments.each do |attachment| %> Attachment [Click here to view] <% end %> <% end %>
<% end %>