Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

I'm going to put it on my recording schedule to record this week.

Yes! This has been on my todo list for far too long. I will most likely be using the https://github.com/rossta/montrose gem for this because it helps generate those future dates and things really nicely. This doesn't really have anything related to saving these objects to the database, so I think that would be hugely valuable along with some simple_calendar support. :D

Just update the Mailboxer config to disable sending emails and you should be all set:

  config.uses_emails = false

Interesting. I've seen some odd things with caching in the browser sometimes and that could definitely do it. Plus they update Chrome so often these days that you never know when they might introduce a small bug or something.

Very glad you're enjoying the series. I had a lot of fun making it! 😎

Posted in Group Chat with ActionCable: Part 4 Discussion

Ah ha! That would do it! Good find. 👍

Haven't seen this myself. What logs are in your Javascript console?

Posted in Group Chat with ActionCable: Part 4 Discussion

Hard to say off the top of my head. You might just need to put in some more debugging lines to make sure that everything is connecting correctly. Make sure that 1) the JS connects to the websocket by watching the Chrome network logs 2) Make sure that your server side background job is executing by printing out in your logs 3) Make sure your user is connected to the channel so their websocket streams from it correctly.

Probably something small isn't connected right and it should be an easy fix once you figure out what it is. Also here's the link to the final app code for this that might be of help: https://github.com/gorails-...

Posted in Direct File Uploads to S3: Part 1 Discussion

I would still recommend setting your domain explicitly. You can use in it to specify a wildcard subdomain so you can handle all of those.

From their docs:

In the AllowedOrigin element you specify the origins that you want to allow cross-domain requests from, for example, http://www.example.com. The origin string can contain at most one * wildcard character, such as http://.example.com. You can optionally specify * as the origin to enable all the origins to send cross-origin requests. You can also specify https to enable only secure origins.

Posted in Direct File Uploads to S3: Part 1 Discussion

AWS docs are some of the worst. Plus every little thing has it's own acronym which makes it even tougher to sift through!

Posted in How return has_many with array instead of object

We chatted in Slack about this and our solution was to use a custom method here in the serializer to build the output as an array of strings rather than an array of objects.

class UserSerializer < ActiveModel::Serializer
  attributes :role_names

  def role_names
    object.roles.map(&:name)
  end
end

Yeah, it's now the default for Rails I believe, so it's a required dependency if you use the defaults. Super easy install with homebrew and everything should be automatically working for you after that.

Your redis server isn't running. If you installed it with homebrew, you can type brew info redis to see the instructions on starting it up again.

Yep, that'll work fine. You don't have to worry about the redis url at all for that. This is a validation to make sure that the browser origin (the domain that attempted to connect to the websocket) is an allowed one.

Basically you don't want someone on another website stealing your chat messages from another site, so this is a protection built-in for that.

It should default to allow localhost:3000, but it seems people are having trouble with that. Your solution is correct, and you'll add to that when you deploy it to production. 👍

Anytime! 🍻

Hey Rob,

I can't remember exactly, but I know a couple people also had trouble with that one. I believe this was where we setup the form to submit as AJAX and hadn't transitioned it over to sending via the websocket just yet.

Your form is submitting, but it's not sending as a JS request, so your create action crashes looking for an HTML response. What you need is to add remote: true to the form so that will render and execute the create.js.erb file we created.

Basically just change this line: https://github.com/robSturcke/halibut/blob/4e4f4dce3360344f9326aee202d156591e2d67e3/app/views/chatrooms/show.html.erb#L12

to the following:

<%= form_for [@chatroom, Message.new], remote: true do |f| %>

That should do the trick! Your form needs to submit via AJAX request so that the browser doesn't reload the page each time you send a message. That'd be a really poor experience.

You're definitely far deeper into Searchkick than I've ever been at this point. :) I agree, some advanced searchkick usage like aggregates and geosearch would be really great to cover. Maybe some custom index stuff like what you're up to would be valuable as well.

So that import: false basically just tells it to create a blank index and ignore all the records in the database right?

Actually... you might check out what the Model.reindex code does. You might be able to pull some chunks from that to create your own method to do the bulk reindex and not clear the index each time. That might let you build a custom method for indexing that could take advantage of any bulk indexing they might have as well as support your multi-tenant application.

Posted in Group Chat with ActionCable: Part 1 Discussion

Credit for that goes to @andrew_fomera:disqus. :D

Posted in Create a welcome page with a tour/get started

This isn't quite the same, but something I thought I'd share: http://introjs.com/ It's used for a lot of intros that need to call out specific things.

The FitBit one looks just like a modal wizard, so you should be able to find some easy Javascript to pull that one off.

For the most part, you'll just want to keep track of whether the user is new by having a column on the user model that gets marked off like intro_complete once they're finished with the tour. You can display the tour the first time and when they close out of it make an AJAX request to mark that column as true so they don't see it again.

The kubernetes one probably just displays that whenever there are no apps, so it wouldn't have to keep track of whether or not the user had seen the intro.

I read this earlier and wasn't quite sure what it was, but that would explain it! :) Happy to help if you have any other questions.

Hey Drilon,

So sending emails is pretty easy, you can just configure ActionMailer with their credentials, but it's a lot more complex to receive emails in an application. There's a brief mention of that here: http://guides.rubyonrails.org/action_mailer_basics.html#receiving-emails

You can use the mail gem to retrieve emails from a pop server which might be what you want: https://github.com/mikel/mail#getting-emails-from-a-pop-server

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.