All threads / File uploads in Rails with Shrine Discussion

Ask A Question

Notifications

You’re not receiving notifications from this thread.

File uploads in Rails with Shrine Discussion

has anyone used Shrine and Backblaze B2 storage?

Reply

Can Shrine make files secure? Ideally, selecting which file attachments are secure and which are public should be possible. Currently hard to do with ActiveStorage as you have to select it for all the attachments. Which is quite Basecamp centric in it's thinking.

yes it can

I have mine setup this way

Shrine.storages = {
cache: Shrine::Storage::S3.new(prefix: "#{ENV["CREDENTIALS_ENV"]}/cache", **s3_options),
store: Shrine::Storage::S3.new(prefix: "#{ENV["CREDENTIALS_ENV"]}/store", **s3_options),
public_store: Shrine::Storage::S3.new(public: true, upload_options: { cache_control: "max-age=15552000" }, prefix: "#{ENV["CREDENTIALS_ENV"]}/public", **s3_options)
}

you should use a gem like lockbox (https://github.com/ankane/lockbox) if you want to encrypt your files. It even has instructions for working with Shrine if you look at the docs.

Reply

What’s the story with Shrine if an application is also using Action Text?

Reply

Thank you for making these videos! They've been helpful. But what if the photos (multiple) are being added as a nested attribute on another model's create action? I've had so much trouble understanding this😫

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 38,558+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.