method
variant
v7.1.3.2 -
Show latest stable
- Class:
ActiveStorage::Attachment
variant(transformations)public
Returns an ActiveStorage::Variant or ActiveStorage::VariantWithRecord instance for the attachment with the set of transformations provided. Example:
avatar.variant(resize_to_limit: [100, 100]).processed.url
or if you are using pre-defined variants:
avatar.variant(:thumb).processed.url
See ActiveStorage::Blob::Representable#variant for more information.
Raises an ArgumentError if transformations is a Symbol which is an unknown pre-defined variant of the attachment.