Messaging with Rails and Mailboxer

I’ll try to look into it.

I believe you can stick with eval here.

recipient = eval("#{r.split(':').first}.find(r.split(':').last)"

Just add some error checkings and whitelist models that can be referenced.

@bodrovis That certainly looks cleaner. I’ll take a look at implementing. Thanks again for the update and for writing this great resource.

Hi there

Is this possible to create more than two conversations between two same users?
When I try to do this, it throws:

Validation failed: Notification base This message must be added to existing conversation (#)

Hi! That depends on what code are you using. Generally, yes it should be possible.

@bodrovis, I am calling

user.send_message(recipient, 'body', 'subject')

each time for same user and recipient. So, for each message, should be created a new conversation.

Can you please tell me how can I do this?

If you were following my tutorial, this should work right away. Doesn’t it work in the demo app on Heroku? If does, but you are experiencing errors with the same code, that’s most likely a bug and should be reported to the dev team I believe.

Hi, Great tutorial, thanks.

You mentionned that attachments can be added to messages.
Could you point me the right direction to do it?

Cheers

Thank you!

Here is the source code for send_message method: https://github.com/mailboxer/mailboxer/blob/b53bab9e93dafcfa499205f2e3170c2b8acb0064/lib/mailboxer/models/messageable.rb#L65

And here is the uploader: https://github.com/mailboxer/mailboxer/blob/1618ae474fa49d6cd583838fbaea827f21fe79cb/app/models/mailboxer/message.rb#L14

So basically they use carrierwave to manage that stuff https://github.com/carrierwaveuploader/carrierwave/

Thank you! That was easy :slight_smile:

Hi, I’ve tried using @chosen_recipients to fill the recipient value with user_id. It is able to grab the id i.e. “new?=2” but it does not populate recipient value when the message is being created and sent. any thoughts?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.