module ActiveStorage::Blob::Representable
def representation(transformations)
ActiveStorage::Blob#representable? to determine whether a blob is representable.
Raises ActiveStorage::UnrepresentableError if the receiving blob is neither variable nor previewable. Call
blob.representation(resize: "100x100").processed.service_url
Returns an ActiveStorage::Preview for a previewable blob or an ActiveStorage::Variant for a variable image blob.
def representation(transformations) case when previewable? preview transformations when variable? variant transformations else raise ActiveStorage::UnrepresentableError end end