I have some code that looks like this:
def wicked_blob_path(active_storage_attachment)
service = active_storage_attachment.service
case service
when ActiveStorage::Service::DiskService
service.path_for(active_storage_attachment.blob.key)
when ActiveStorage::Service::S3Service
active_storage_attachment.service_url
else
raise "Unsupported ActiveStorage service for WickedPDF integration: #{service.name}"
end
end
It seems to barf in production with an error: uninitialized constant ActiveStorage::Service::DiskService
I feel like this should be initialized, but it isn’t.
It appears to be a part of the Rails standard library: ActiveStorage::Service::DiskService
I have a section in my config/storage.yml
file for it:
local:
service: Disk
root: <%= Rails.root.join("storage") %>
I’m using Rails version 6.0.3.1.
I could maybe re-factor the method to first check if defined? ActiveStorage::Service::DiskService
but that doesn’t seem like the ideal solution, especially if this service should be defined.