Listing pms

<% message = @pms.where(recipient: current_user) %> <% unless message.empty? then message.each do |pm| %> <% end %> <% else %> <% end %> <% message = @pms.where(author: current_user) %> <% unless message.empty? then message.each do |pm| %> <% end %> <% else %> <% end %> <% conversations = current_user.mailbox.inbox %> <% if !conversations.nil? %> <% 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.nil? %> <% conversations.each do |conversation| %> <% receipts = conversation.receipts_for current_user %> <% receipts.each do |receipt| %> <% message = receipt.message %> <% end %> <% end %> <% else %> <% end %>
Author Recipient Message

Inbox

<%= pm.author.user_name %> <%= pm.recipient.user_name %> <%= pm.message %> <%= link_to 'Show', pm %> <%# link_to 'Edit', edit_pm_path(pm) %> <%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %>

No New Messages

Outbox

<%= pm.author.user_name %> <%= pm.recipient.user_name %> <%= pm.message %> <%= link_to 'Show', pm %> <%# link_to 'Edit', edit_pm_path(pm) %> <%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %>

No New Messages

Conversations

Inbox

From Subject Body
<%= conversation.last_sender.user_name %> <%= message.subject %> <%= message.body %> <%# link_to 'Show', pm %>

No Messages

Outbox

To Subject Body
Doesn't work <%= message.subject %> <%= message.body %> <%# link_to 'Show', conversation %>

No Messages


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