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!
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.
As I understand it, Mailboxer uses Carrierwave for processing attachments.
Does it make it hard to use Refile instead?
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.
Nice episode Chris , worthy mentioning mailboxer doesnt work with sqlite3 you have to use postgres or mysql
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
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!
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!
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.
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:
u = User.alland then
u.conversations.destroy_all, it says it can't find that model.
Thank you for your help!
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!
Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.