Skip to main content

Active Storage (Rails 5.2) vs Shrine

Rails • Asked by Nicolás Bobb

Fallback

In the aplication, users have to upload files, I plan to use Amazon S3.
Do you recommend using Rails 5.2 Active Storage, or using the Gem Shrine as explained in Gorails?

What do you recommend?


Fallback

Any Gem you have used before? go with that ootion. If you used Shrine before, definitly go with that.
I haven't used AS yet, but have heard it is not as fully featured as, eg Shrine


Fallback

Active Storage works fine for file uploads especially to s3 and works nicely, but honestly I'd probably wait a bit until they cut the 5.2 release since there are still some open issues on it. As Jack mentioned it's not as feature-rich as Shrine or other gems. I'm on 5.1.4 and I use either Shrine or Carrierwave as my needs are simple. Honestly, probably best for you to test out both and see which one fits your use case.


Fallback

If you need to validate your files, for example validate that only certain file types be uploaded or that some file size constraints (no files bigger than X megabytes) are adhered to, use Shrine.

Also Active Storage currently has no way to retain uploads between form redisplays. So for example if a User uploads a 20MB video to your site and the form needs to get redisplayed because the User has forgotten to input a Video title or some other validation fails, the Video is gone.

There are many other features Active Storage currently lacks, like data URI uploads.

The missing validations and no way to retain uploads on form redisplays make Active Storage more of a toy in comparision with Shrine at the moment. If you can live without those features though, go for Active Storage, as its much simpler to set up.


Login or create an account to join the conversation.