1

I am having the hardest time with the mailboxes gem. I have gotten it working in that I can send and receive messages, but for the life of me I cannot figure out how to display them. i want to display the inbox in table organized like this:

message sender | message subject | message sent date

I have been working for hours to try and figure out how to access the sender of the message in the receivers inbox, but I can't figure it out. I've tried looping through conversations, receipts, notifications, etc and I still cannot figure out what to do. I can't use:

#user wants to retrieve all his conversations
user.mailbox.conversations

#user wants to retrieve his inbox
user.mailbox.inbox

#user wants to retrieve his sent conversations
user.mailbox.sentbox

because there is no way to organize how the messages are displayed using those methods (at least as far as I know). How can I loop through the messages and find the message sender for each message?

Philip7899
  • 4,599
  • 4
  • 55
  • 114

1 Answers1

3

A Mailboxer::Message is a Mailboxer::Notification

And you can have the notification's sender: message.sender

A Mailboxer::Conversation is a collection of messages.

You can get the participants, even the originator (plus many other) from it.

Is it clearer?

apneadiving
  • 114,565
  • 26
  • 219
  • 213
  • Thank you. That clears up some things actually. I was able to get my inbox to work, but now I'm having even more trouble with the sent box. Would you mind taking a look at this question I posted: http://stackoverflow.com/questions/21417883/how-to-access-recipient-on-sent-messages-page-with-mailboxer – Philip7899 Jan 28 '14 at 22:03