Ask A Question

Notifications

You’re not receiving notifications from this thread.

In-App Messages Between Users Discussion

Great episode Chris!

Can't wait to get into the more advanced stuff.

Thanks!

Reply

Great episode mate, nice one.

Reply

Thanks for another great episode Chris! I have two questions for you.
Is there a way to make Mailboxer work with ActionCable?

And another question is, what key mapping are you using to escape INSERT mode in vim? I'm mapping "jk" and "kj" to "<esc>" key and I was wondering if there's any other good key mappings for that.

I'm looking forward to the next episode, thanks Chris!

Reply

Yep of course! The same reason that you have to build your own controllers and views with mailboxer is the same reason why it will work perfectly with ActionCable. It really just handles the database side of things, which ties in perfectly with ActionCable. You'll still need to build the channels and everything, but it should work without a problem. Going to be covering this in a future episode as well.

I actually just continue hitting escape. It's a bit easier to reach on the Mac keyboard, so I haven't remapped it. I know a lot of people will play around with replacing caps lock for things like that or the leader key.

Reply

Would you know if one can make Mailboxer work with Action text?

Reply

Hi Chris,

As I understand it, Mailboxer uses Carrierwave for processing attachments.
Does it make it hard to use Refile instead?

Best

Reply

I don't entirely know how the attachments feature in Mailboxer works so I can only give you a rough idea of the direction to go. I think you could probably override the Mailboxer::Conversation model in your app and then add Refile into it if you didn't want to use Carrierwave. That should let you do what you want there.

Reply

Nice episode Chris , worthy mentioning mailboxer doesnt work with sqlite3 you have to use postgres or mysql

Reply

Interesting. It looks like it does support it. I don't see that mentioned anywhere that you must use pg or mysql and their example app uses sqlite3: https://github.com/mailboxe...

Reply
dancinglightning dancinglightning

Interesting topic and certainly well presented.
On the mailboxer github page there is a command similar to devise

>rails g mailboxer:views

Maybe that saves one having to do it from scratch

Reply

Unfortunately that only generates mailers which you can see here: https://github.com/mailboxe...

Reply
Josh Zandman Josh Zandman

In my show view for a song: when I click 'Message Me' I would like to generate a new conversation and grab that user's id (the one who created that song) so it sends to that user (Instead of choosing from a list of users). Any help would be great, thanks!

Reply

Just pass in the user_id in the URL on the link, and then set it as a hidden field inside the form rather than a select tag. That should do the trick!

Reply

Version 0.14.0 was released in July 2016 so there is at least 1 newer version since this tutorial was created... so using gem 'mailboxer' instead of the github version was fine for me.

Reply

A year later, is mailboxer still the best quick option?

Reply

As far as I know, yes it's still the go-to. Messaging doesn't change that much so I wouldn't expect a whole lot of change for it.

Reply
Hi Chris, 

I'm getting this error for my `receipts_for' method:

undefined method `receipts_for' for nil:NilClass mailboxer

Searched all stackoverflow and tried a few work arounds. But nothing successful. Do you have an idea how I can define it?

This is my stackoverflow question: https://stackoverflow.com/questions/50571501/undefined-method-receipts-for-for-nilnilclass-mailboxer-gem-rails

Looking Forward to Your Reply!

Best, 

Aly
Reply

Hi Chris,

Another fantastic tutorial.

a) If we install mailboxer and down the line want to give users the option to add multiple receipients, i.e. a 'private group chat', does mailboxer allow this? If so, this looks like a great option. *UPDATE: I see that video 3 discusses this. *

b) I installed notifications using your other tutorial. Should I use that same line of code here to create notifications in our bell, or is it best to use the mailboxer notifications? Or is it a combination of both?

c) I saw one person ask about how a user can trash/delete messages, but it doesn't appear you've yet responded. Is that covered as well?

Thanks ever so much.
-Monroe

Reply

I posted these questions in Slack, but also posted them here, because I'm sure the answer will help someone else:

I am working on the in-app messaging, and I have two issues:

  1. I am trying to delete all conversations in rails console. But when I type u = User.all and then u.conversations.destroy_all, it says it can't find that model.
  2. I don't know why, but there is database data showing up at the bottom of the conversations index, and also the message show pages. Like this: https://gyazo.com/b343640d979eb42f9c12c19c6d64a55d Does anyone know why that is showing up? The views have no extraneous code. (edited)

Thank you for your help!

Reply

Chris just answered my question in the Slack group. Here are the two answers:

1) @blatz was right about calling the association on a relation, User.all wouldn't be an individual record with associations, you could only call scopes on it. if you did User.first.conversations you could destroy_all. Or you can just use Mailboxer::Conversation.destroy_all.
Mailboxer models are namespaced, you can see them in the gem. It's one of those gems that referencing the source code comes in handy pretty often

2) The extraneous prinout is because you have an equals in your loop <%= when you don't want it. It should be <%

And... both answers were spot on (as if Chris could provide anything less).

Thank you to Blatz too for your help. Onward!

Reply

I'm in the middle of my graduation project, and I have no idea how to attach it to two models, User and Doctor and that they can chat in real time? did someone figured it out?

Reply

Hey Chris - The gem in this video hasn't been updated in a little under 2 years now. Is there a better way to implement In app messaging with rails 6? especially with Jumpstart?

Reply

Is this gem still relevant? I am implementing messaging in my app and I see that the most recent commits on GitHub say the gem no longer works with newer Rails?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.