Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

Hey Haytham! Great to have you. :)

Shopify actually has quite a few different methods of integration. There are all kinds of different things you can do with it. I don't personally know too much about it aside from just using their API, but I'd probably start with trying to figure out what type of integration you want to build with them. They list a bunch of the options here: https://help.shopify.com/api/sdks/shopify-apps

By default it's going to accept any file types no matter what you use for file uploads. All those files will get their own database records if you have it so each upload is sent individually. That's what we covered in this episode: https://gorails.com/episodes/multiple-file-uploads-with-shrine

Give that a watch and see if that answers most of your questions. 👍

Since this never really hits your Rails app and the uploads are direct to S3, the configuration is gonna have to be on the S3 side. This post here (https://aws.amazon.com/articles/1434) talks about setting a policy where you define the content-length-range which will correctly reject the file upload if it's outside those boundaries. I'm not quite sure exactly where that goes, possibly it has to be passed into the Shrine when it generates the presign signature unless it can be defined in S3 itself (which might be possible too). Probably work posting an issue on Shrine to ask for his advice there as he'd konw more about this than I do.

Posted in Spell check

Unfortunately I don't believe that SimpleMDE supports the browser's spell check functionality because it's a custom editor.

Posted in Authorization with Pundit Discussion

It shouldn't make any difference. Traditionally people do includes at the very top and that's what I generally do too, but in this case I just pasted below to make it a little more clear.

Posted in Where should I start?

Hey Kelvin! I'd recommend starting at the first episodes and working your way through them. I don't have a particular order or anything with GoRails, although I probably should. :)

GoRails is mostly designed to be like a reference for you. You might want to build a product with a specific feature and hopefully you'd find an equivalent episode in GoRails to add that feature. If you don't find one, just let me know and I'll try to cover it for ya. 👍

If you submit the delete request, you could have two different Javascript snippets run, one for each of the different interactions you want to have.

For example:

// Hide the favorite 
$("#favorite_<%= @favorite.id %>").hide()

// Make the item gray
$("[data-favorite-id=<%= @favorite.id %>][data-behavior='heart").removeClass("active")

This way your HTML can include the features you want on that page and the Javascript will modify whatever it finds on the page. I showed two different selectors you could use for this. I find using data-behavior to be particularly handy so you can have multiple pieces of functionality on the page for a single favorite and search for them easily.

Posted in How do I upload files larger than 2GB?

Hey Jimmy,

Yeah that stuff can be gnarly. Generally, it's probably best to do the direct to S3 uploads so that you aren't bogging down your server with uploads. That's going to take a load off your server and then you can process that file later in background jobs if needed.

I'm not really an expert on uploading massive files but that's probably the best place to start. I'm sure that Janko the author of Shrine can help with more ideas if you message him about it. Also maybe some other people in the community here have handled situations like that who can give some advice for uploading and processing big files.

Posted in Group Chat with ActionCable: Part 7 Discussion

Hey Stephane, I would do a join table for this because as things get more complex you'll want to probably support extra features like different roles for users in the room (like Slack allows you to invite guests to specific rooms) and the best way to do that would be with the join table. They're still fast to query and can store all the additional data you might want on it.

Posted in integrating analytics

Just for reference, this week's episode is on using Segment for analytics: https://gorails.com/episodes/analytics-with-segment?autoplay=1

Next week I'm also going to cover using the Ahoy gem for those of us who just need to track analytics internal to our apps.

As Jack mentioned, the RSS feed is probably the easiest way to do that: https://gorails.com/episodes/pro.rss 👍

Posted in Analytics with Segment Discussion

Yeah, for some things for example you may want to track form submissions. Frontend code generally would just track the form submitting, but not whether or not it was successful. This can be useful and you may want to know attempted submissions vs successful submissions as an example.

You're not going to be slowing down your code in either case. Frontend runs in the user's browser so it won't slow anything down. Server-side events are submitted in asynchronously so they won't affect the speed of your code there either.

As for complex integrations, generally analytics are just designed to be an additional line of code that runs in your logic. You will already have methods or classes for that logic so you'd just drop in an additional line to says "Purchase complete" after running through your payments code.

I'll try to come up with an example to go a bit more in-depth on. Generally analytics aren't anything too complex, you've just gotta make sure you write good names for events so they make sense when you're analyzing them later. :)

Posted in Analytics with Segment Discussion

Got any specifics you'd like to see?

Posted in Simpleform association with images!

Doh. I looked at your code and didn't have any good answers. Didn't cross my mind that the table might be missing. 😜

You can still create a users controller even if you use Devise so you can make the /users.json endpoint. Devise doesn't define a GET route for /users, just POST and PUT which means you're free to create one or you can make a different route as well.

Sweet, I haven't used zipline myself but that sounds awesome.

Are you primarily working with small file sizes? I would imagine this could get problematic if someone tried to zip a gigabyte or something, but hopefully that's not an issue you have to worry about yet.

  • I think parsing the S3 bucket logs could work but it may be hard for you to tell who did what if you want to track who did what.
  • I have done the redirect version of this before for http://feedforward.io/ and it works pretty well. You link to /whatever/1/download and then record the download and then redirect the user to the actual download url. Works pretty well.
  • Another thing you could do is use a JS tracker like Ahoy or Mixpanel, etc where you track it with an AJAX request when the user clicks the download link. This means you don't have to have anything special going on in your app and you can use third party analytics tools like Mixpanel really easily.

I'd probably go with one of the latter options for simplicity.

Posted in Liking Posts Discussion

Well, you can cache the user signed out version and use that everywhere. That will cover a lot of things if your website gets much traffic from search results. The other thing I'd say is to use an AJAX request or just embed the IDs in the HTML somewhere for the logged in users and just have JS update the cache'd snippet visually to reflect whether the user had voted on it.

This way you can use the same cache for literally everyone and then just tweak it visually based upon the current user with a little JS. That's how I'm handling the watchlist and completed states of videos on GoRails now so I can have a single cache for every episode and then update it visually for logged in users.

Posted in Simpleform association with images!

Hey Martin,

Could you post the full error and a bit of the stacktrace as well? I'm guessing it has something to do with your associations.

I haven't seen the can't write unknown attribute error message recently so I'm not quite sure what it refers to. Googling it leads me to believe maybe your Bucket doesn't have a message_id column or your associations are backwards maybe? https://stackoverflow.com/questions/20295710/activemodelmissingattributeerror-cant-write-unknown-attribute-ad-id-with-f

Posted in Free SSL with Rails and Nginx using Let's Encrypt

You'd want two server blocks like you said and each one would point to different SSL certs if you wanted them both on SSL.