debshots/config/initializers/shrine.rb
Christoph Haas 6d0ed8c8f8 Adding prefix /shrine for static images
Otherwise /screenshot/:name might get confused with
/screenshot/simage/123/small-123.png
2021-02-13 22:16:37 +01:00

21 lines
874 B
Ruby

# See also: https://github.com/erikdahlstrand/shrine-rails-example/blob/master/config/initializers/shrine.rb
require "shrine"
require "shrine/storage/file_system"
# both `cache` and `store` storages are needed
Shrine.storages = {
# Saves to ./public/screenshot/ID/image/…
cache: Shrine::Storage::FileSystem.new("public", prefix: "cache"),
store: Shrine::Storage::FileSystem.new("public", prefix: "shrine"),
}
# See plugin documentation at https://shrinerb.com/docs/plugins/activerecord
Shrine.plugin :activerecord
Shrine.plugin :instrumentation
Shrine.plugin :determine_mime_type, analyzer: :marcel, log_subscriber: nil
Shrine.plugin :cached_attachment_data
Shrine.plugin :restore_cached_data
Shrine.plugin :derivatives # up front processing
# Shrine.plugin :derivation_endpoint, # on-the-fly processing
# secret_key: Rails.application.secret_key_base