Provider selection
Providers.for_storage walks Config.enabled_providers in order and returns the first provider
that supports the app's storage:
:s3supports it only when the app's defaultActiveStorage::Blob.serviceis anActiveStorage::Service::S3Service(i.e.service: S3instorage.yml).:tusis storage-agnostic but is only available whenConfig::Tus.endpointis configured.
Because the list is ordered, earlier entries win. [:s3, :tus] prefers S3 when the default service
is S3-backed and falls back to tus otherwise; [:tus, :s3] prefers tus whenever it is configured.
Config.enabled_providers defaults to [], which disables chunked uploads entirely (file fields
fall back to base64, fully backward compatible). An unknown provider name raises
Eluvia::Errors::StandardError from Providers.validate_enabled_providers!, so a configuration
typo fails loudly instead of silently disabling chunked upload.
When no enabled provider supports the app's storage (e.g. only :s3 is enabled but the default
service is Disk), every field falls back to base64 and no upload block is emitted in its
schema. The same happens if aws-sdk-s3 is not loaded (Providers::S3#supports_storage? returns
false) even though :s3 is listed.
Unlike the Python library, which resolves a provider per field against that field's own
storage, Ruby habarico resolves a single provider for the whole app —
Providers.for_storage takes no field-specific storage argument, both providers ignore the
storage: keyword they are handed. A model with file fields on different storages does not get a
provider chosen per field; all chunked-capable fields share whatever the app's one default service
is.
See also
- Configuration —
enabled_providersand provider-specific settings - Frontend contract — what
options.uploadlooks like per provider