markevans/dragonfly-s3_data_store

Possible to Have Different Buckets for Different Models?

Opened this issue · 2 comments

I have all my image uploads going to s3.mydomain.com but for an attachment feature I'd like them to go in their own bucket attachments.mydomain.com

Is it possible to have different configurations for different models?

not currently, but you can assign e.g. model accessors to different dragonfly apps, each which have a differently configured s3 data store (as per http://markevans.github.io/dragonfly/models first couple of paragraphs).
Does that suit the use case?

For anyone coming across this, as I did: this approach works, but it's easy to miss that you'll need to have a middleware line once for each bucket/app, as described here. For example:

Rails.application.middleware.use Dragonfly::Middleware
Rails.application.middleware.use Dragonfly::Middleware, :attachments