Monroe Mann

Joined

6,790 Experience
53 Lessons Completed
1 Question Solved

Activity

Posted in User Referral Program From Scratch Discussion

TIP: If any of you are using validations in devise, before_create in the user.rb file may not work, and you will get an error.

Therefore, try changing that line in user.rb to before_validation and you may find that it works.

Posted in Group Chat with ActionCable: Part 4 Discussion

TIP: One more thing: and if the redis server isn't running, and you try to go to a page where the redis server isn't running, the rails server will perhaps crash. Therefore, it seems best to launch the redis server prior to launching the rails server, so you don't get an error if you end up heading to a page that requires the redis server.

Posted in Group Chat with ActionCable: Part 4 Discussion

Update: Chris helped me out. Here's the thing that was covered in another video, but not made clear in this video: installing the redis gem alone is not enough: YOU MUST ALSO INSTALL REDIS TO YOUR COMPUTER AND LAUNCH IT. It's a server, just like postgresql. And it needs to be running. So if you have the same problems I was having, it may be because you didn't have redis actually installed, and it wasn't running.

Another thing I learned: in a model, if you have any associations through another, you must first declare the 'another' on the line above the 'through' association, or you'll get an error.

Thanks Chris!

Posted in Group Chat with ActionCable: Part 4 Discussion

Hi Chris,

Question: Two errors that I'm hoping you can assist with:

  1. https://gyazo.com/19aaab916790ec3c1a41476cc621398b It says the redis gem is not loaded. But it is. I found some posts on StackOverflow that says the redis gem 4.0.2 doesn't work with ActionCable, so you needed to use 3.3. But I installed 3.3 and still no success. Is there perhaps some type of additional setup? I did make sure to change the cable.yml as follows:
development:
  adapter: redis
  url: redis://localhost:6379/1

test:
  adapter: async

production:
  adapter: redis
  url: redis://localhost:6379/1

Anything obvious that I am missing, or forgetting to do?

  1. This may be relate to the above question. In console, when I type a message, it disappears properly. And posts when I refresh the page. But it's not showing up in the other console as an object, as the video suggests it should. Thoughts?

Thanks very much!
-Monroe

Posted in Group Chat with ActionCable: Part 3 Discussion

This may help some of you.

If you find that this code doesn't work:

$(document).on "turbolinks:load", ->
  $("#new_message").on "keypress", (e) ->
    if e && e.keyCode == 13
      e.preventDefault()
      $(this).submit()

Try changing the last line to reflect an ID, like this:

$("#new_chat_message").submit()

For some reason, using (this) didn't seem to work for me, but using the ID worked great.

Posted in Advanced Mailboxer: Multiple User Conversations Discussion

Hello!

Does anyone know how to fix this issue? The ampersand is showing up in html, rather than showing the ampersand symbol. Ironically, Chinese characters show up fine. :D

https://gyazo.com/453666ac5e03a51dcde533c001f060d2

Thanks for any feedback.
-Monroe

Posted in Can a Rails app be converted into a Progressive Web App?

I know gonative.io can turn your rails app directly into a native mobile app on android and ios. I don't know if it works for APIs. Also, I haven't yet done it myself, but there's a cool feature on the homepage. Just type in your rails app url and it automatically shows you what it would look like as a mobile app. Costs about $600 I think to do the conversion.

Posted in In-App Navbar Notifications Discussion

This is the error in the rails console:

https://gyazo.com/c14ed47cb5fbe8dbf3cb7158c4865407

Does this mean I forgot to create a post method somewhere?

Posted in In-App Navbar Notifications Discussion

Okay! I'll try that. :D

Posted in In-App Navbar Notifications Discussion

I believe Chris created a newer video that shows how to do this using actioncable.

Posted in In-App Navbar Notifications Discussion

I have noticed this same issue. The bell itself doesn't appear for about 2 seconds, and then 3 seconds later, the notification number appears... If anyone has a fix, that would be great.

Posted in In-App Navbar Notifications Discussion

Hi Chris!

The notifications are working. What you call threads, we call posts, and what you call posts, we call comments.

Two issues:

1) It only works when the json.url line is commented out:

json.url post_path(notification.notifiable.post, anchor: dom_id(notification.notifiable)) 

As soon I uncomment, notifications totally stop working--the number disappears from the bell, and the notification messages themselves also disappear. Once I comment out the line again, the bell numbers return, and so do the notifications. Thoughts on how to get that to work? We definitely would like each notification to be linkable to that particular event.

2) we are showing messages for both posts (post_path) and also comments (comment_path). But how will index.json.builder know when to follow the post_path, and when to follow the comment_path? And then again, once we add other notifiable events, like reaching a higher level, etc.?

Thanks very much!
-Monroe

Ahh, once it's automatic, then it's all on autopilot, and that would be fantastic. Do you have any idea when they may be implementing the automatic referral payouts?

Also, do you happen to know if there's a way to setup 'repeated payouts', i.e. if you refer someone to us, then every time that person purchases something from our site, you would receive a 5% payout for that purchase for life? That would be neat.

Posted in Team tracking?

Hi Chris,

Is there or will there be a way to see which videos my team have watched, and how many, and what their XP scores are, etc, all on the team page? And see whether they actually watched, or just clicked 'completed'? Having some basic stats will help me to know who is taking advantage of the subscription, and who is not. It's not crucial, but would be helpful down the line to encourage more communication between the team, and to help me know what videos are of most interest to those on the team.

Thanks for your consideration.
-Monroe

Posted in Group Chat with ActionCable: Part 5 Discussion

Hi Chris,

Do you mean 10,000 simultaneous users of the chat, or just having 10,000 users on the site itself?

-Monroe

Posted in In-App Messages Between Users Discussion

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!

Posted in In-App Messages Between Users Discussion

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!

Great stuff. Thank you again!

Question: if someone does end up refactoring or updating the gem, does that mean that suddenly our mailbox uploading feature will cease to function? Or would that only be an issue if we updated to a revised version of the gem without making the required new changes to the code?

Winner! :D

Agreed!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.