I’m building a simple messaging system into my app, and using mailboxer to do this. I’m trying to list out all of the messages that a user has received including the body, and name of the sender. I’ve been trying to use the code in https://github.com/RKushnir/mailboxer-app as a template, but I just can’t get things to work. So far I’ve figured out how to get a array with the receipts that they own, but haven’t figured out how to get the notifications that got with those receipts.
My User model is the messageable model.
I’ve been able to get to a message that belongs to a user through
@message = current_user.mailbox.inbox.first.messages.first.body
But this doesn’t seem efficient, and I’m struggling to iterate through all the conversations to pull out all the messages.
Thanks
This is how I did it:
This only works since all of the conversations will only have one message attached to them, I’m not sure what to do when later on conversations have more than one message.