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_to_limit: [100, 100]).processed.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