Conversations

<% conversations = current_user.mailbox.inbox %> <% if !conversations.empty? %> <%# require 'pp' %> <%= conversations.class %> <% conversations.each do |conversation| %> <% receipts = conversation.receipts_for current_user %> <% receipts.each do |receipt| %> <% message = receipt.message %> <% end %> <% end %> <% else %> <% end %> <% conversations = current_user.mailbox.sentbox %> <% if !conversations.empty? %> <% conversations.each do |conversation| %> <% receipts = conversation.receipts_for current_user %> <% receipts.each do |receipt| %> <% message = receipt.message %> <% end %> <% end %> <% else %> <% end %>

Inbox

From Subject Body
<%= conversation.last_sender.user_name %> <%= message.subject %> <%= message.body %> <%# link_to 'Show', @pms.where(conversation: conversation) %>

No Messages

Outbox

To Subject Body
Doesn't work <%= message.subject %> <%= message.body %> <%# link_to 'Show', @pms.where(conversation: conversation) %>

No Messages


<%= link_to 'New Pm', new_pm_path %>