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.
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.
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.
Question: Two errors that I'm hoping you can assist with:
- 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?
- 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!
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:
For some reason, using (this) didn't seem to work for me, but using the ID worked great.
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
Thanks for any feedback.
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.
This is the error in the rails console:
Does this mean I forgot to create a post method somewhere?
Okay! I'll try that. :D
I believe Chris created a newer video that shows how to do this using actioncable.
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.
The notifications are working. What you call threads, we call posts, and what you call posts, we call comments.
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!
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?
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.
Do you mean 10,000 simultaneous users of the chat, or just having 10,000 users on the site itself?
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:
- I am trying to delete all conversations in rails console. But when I type
u = User.alland then
u.conversations.destroy_all, it says it can't find that model.
- 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?