instance method
representation
Ruby on Rails edge
Since v7.1.6Signature
representation(transformations)
Returns an ActiveStorage::Preview or an ActiveStorage::Variant for the attachment with set of transformations provided. Example:
“‘ avatar.representation(resize_to_limit: [100, 100]).processed.url “`
or if you are using pre-defined variants:
“‘ avatar.representation(:thumb).processed.url “`
See ActiveStorage::Blob::Representable#representation for more information.
Raises an ArgumentError if transformations is a Symbol which is an unknown pre-defined variant of the attachment.
Parameters
-
transformationsreq
Source
# File activestorage/app/models/active_storage/attachment.rb, line 176
def representation(transformations)
transformations = transformations_by_name(transformations)
blob.representation(transformations)
end
Defined in activestorage/app/models/active_storage/attachment.rb line 176
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attachment