plugin :default_storage, store: :listing_store
listing_store: Shrine::Storage::S3.new(prefix: "listings", **s3_options)
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/398dc88b-d72b-4af7-8093-c8dd63e49bc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Well, an alternative is to modify `#generate_location` for each uploader to add the desired prefix.class ListingUploader < Shrinedef generate_location(io, context)"listings/#{super}"endend
The only difference is that this way the prefix will be included in the attachment id, while with the :prefix option to the storage this is not the case.Both are fine, but if you are creating a new storage for every uploader, it's probably simpler and makes more sense to go with the strategy of overriding `#generate_location`.Kind regards,
Janko
On Sun, Mar 19, 2017 at 4:32 PM, <josuea...@gmail.com> wrote:
Hi,Im now using this inside each uploaderplugin :default_storage, store: :listing_store
And inside the initializerlisting_store: Shrine::Storage::S3.new(prefix: "listings", **s3_options)
This is just because I want different prefix per uploader, I have also a photo_store with the prefix "photos", etc.I tried to pass the prefix: option with the upload_options plugin, but I got an error saying thats an invalid argument.Im right using different storages just for change the prefix or is a better way to do this?Thanks!
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
class MyUploader < Shrine
plugin :processing
plugin :versions
process(:store) do |io, context|
original = io.download
thumbnail_dimensions =
case context[:record]
when Listing then [300, 300]
when Photo then [200, 200]
end
thumbnail = resize_to_limit(original, *thumbnail_dimensions)
{original: original, thumbnail: thumbnail}
end
end
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/95caf92a-0790-4c71-9a8e-7cff1ac7b194%40googlegroups.com.