Chris Oliver

Joined

292,970 Experience
93 Lessons Completed
295 Questions Solved

Activity

Posted in Using Webhooks with Stripe Discussion

Yep. You can implement the subscription webhook that gets triggered on delete (or cancel, don't remember the exact name) and just have it remove it from the user on your end. You'd build it same as the other one, but just remove the subscription ID from the user.

Posted in Video request: react-rails + caching

I'm hoping to get into React soon!

One of the main things with caching for it will be that you only really need to focus on caching your JSON that the React code will load since it generates the HTML. You won't get performance benefits from caching HTML like you would with Rails, so you can do it on the JSON instead.

Hey Giorgos,

This is absolutely a complicated thing to do unfortunately. There are a lot of things that just aren't well defined yet for recording audio and video.

  1. The best place is probably going to be storing your videos on Amazon S3. You can use their transcoding service to make the videos web compatible and take screenshots and send the results back to S3. You can also put up a Cloudfront CDN in front of that so downloading the videos will be faster. You'll also only pay for what you use, so the more downloads you get, the more you'll pay. Helps to have your costs scale accordingly.

  2. You can check out some things like this which will allow you to record the webcam and audio in HTML5. https://addpipe.com/blog/mediarecorder-api/

And there's webcamjs which will be useful I'm sure: https://github.com/jhuckaby/webcamjs

I don't know too much about all this but I'm likely going to be diving into a video project deeply sometime soon so maybe I'll know more in a month or two.

Posted in Group Chat with ActionCable: Part 1 Discussion

I like the added_attrs array. It's nice to reuse since I had always just defined the items in each place.

Posted in Group Chat with ActionCable: Part 4 Discussion

Hey Diane,

Two different approaches you could use:

1. Keep it simple and go with a Turbolinks-Android hybrid app where your chat is via the webview on the app. This is simpler and easier to setup.
2. You could do a native Android connection directly to the websocket. For this you'd basically use a standard websocket library for Android and then make the small tweaks necessary to setup the consumer just like the Javascript does. You'd basically be porting that JS into Android code. Not entirely sure on all the details or if someone else has done this already, but that's the rough outline for a native approach.

Posted in File Uploads with Refile Discussion

Glad you got that working! Certainly seems weird that it wasn't picking up any environment variables! I don't think I've ever run into that, but it makes sense why you were having that problem then.

Posted in Group Chat with ActionCable: Part 4 Discussion

Glad you like it! 🎉

Posted in Group Chat with ActionCable: Part 4 Discussion

I gotcha now. So I would keep everything organized on the Message's ID. You can client side send over a message and you could set it up to send back a message ID. That way you now it arrived server side but it's "processing". Then server side you can store that message and tag all your ActionCable broadcast stuff with the Message record's ID. You'll get a database log of messages which is important for loading up the first time, you can load recent history, and you can use that for troubleshooting. The Message record can have a statemachine on it so you know if it was broadcast or not. Slack basically does this when you're having internet issues. It can tell when something got published or not and keeps track of that nicely. You can flag those messages as "ready for broadcasting" or something and then after you broadcast it in the Relay Job, you could then mark it as complete so that if your job did crash or something, you wouldn't resend it.

Posted in Bonsai vs AWS Elasticsearch?

As long as they're both recent versions, AWS is probably going to be better scaling, but you probably can't go wrong either way.

Posted in Group Chat with ActionCable: Part 4 Discussion

Not sure I'm following the question, can you clarify for me? 🤓

Posted in Subscriptions with Stripe Discussion

Well if you've got the subscription ID, you can then look up the active subscription and modify the plan just like you would when a user edits their plan.

Oh really good topic! I usually try to avoid it as much as I can, but there's always uses for it because you'll never be able to fully express SQL with an ORM.

I was just reading this post on doing trending posts in Postgres and it was one of those great places where you'd want to drop down to raw SQL to create those functions and things that you could reference later with ActiveRecord: http://sorentwo.com/2013/12...

I'll have to definitely do a screencast on this.

Posted in Subscriptions with Stripe Discussion

You can fail early server side if there's a subscription ID on the user so you can hopefully avoid double charging them. I believe stripe does allow you to have multiple subscriptions per user, so you may not want to rely on that.

If you want to use an external JS file you can just include the script tag that points to it in your layout.

The reason why you would want these inside your Rails app is that they can be included and minified inside your code reducing the number of files the browser has to download. It's faster and more efficient for your users which makes it a good idea.

Posted in File Uploads with Refile Discussion

Hmm, sounds like you've got everything correct! I have used the exact same setup before and it works fine. I'll have to think on it and see what comes to mind.

Posted in File Uploads with Refile Discussion

It's possible that Refile just isn't able to find the executable for imagemagick. It's looking for the "identify" command so you'll want to make sure that's in one of the folders in the PATH for the same user that Nginx is running as. I'd poke around at that and see if you can figure out why it might not be able to find the identify executable. If you installed imagemagick with apt-get then it should be available, but if you compiled it or something else, then it's probably just not in the PATH.

Since Searchkick is a whole separate process, it won't know about your Rails stuff. What I would say is if you write a helper method or class you can have it apply that scope to the options you pass in so that it always searches the same default scope.

Posted in A series on Turbolinks 5

Marek, this would be a killer series to make. I would love to do it. So far, I've been using Turbolinks 5 for a few things but of course have also gotten caught by some of the gotchas so I still need to figure out some solutions to various things so I have a good idea of what all the gotchas are and what decent solutions should be.

Maybe we can use this thread to start keeping a list of topics to cover!

To start:
One of my biggest issues with Turbolinks has been that Chrome doesn't respect clearing the cache on a login of a page. So GoRails for example, I used to use root as the homepage, you would login, and I would replace root's contents with your dashboard. Chrome has a bug in it where it doesn't clear the cache for root until you do an actual browser refresh. The solution I had was to move your dashboard to /dashboard to avoid the cache problems there.

Posted in Group Chat with ActionCable: Part 3 Discussion

I'm not sure I would use ActionCable for uploading files. I would probably just send them like normal using AJAX.