Shrine for File Uploads

tags: [jason] [gorails] [shrine]

I’m working through how to do file uploading, and it seems like Shrine gem is a great way to add this feature.

It’s a bit complex and I’ll have to learn how to use it but luckily, GoRails has a lot of material on in.

Here are the Srine docs (shrinerb.com)

The design architecture follows:

Assuming we want the attributes to be called ‘photo’

Getting it into my app

I’ll just set it up locally first and then worry about amazon later. GoRails does a great job of breaking it up like this.

Gotcha’s for the form implementation

Setting up the configurations with s3

Shrine also allows for front end file uploading and there’s great videos through GoRails. I’m thinking I’ll just do the simple straight set up and add the front end stuff later if I have time.

There are chache and store directories

Implementation mental models

Shrine first stores the image in a /cache folder until the object becomes permanent, at which time it will store another copy of the image in /store