Merge pull request #42740 from dmarcoux/document-active_storage-attachment-variant

Document ActiveStorage::Attachment#variant
This commit is contained in:
Zachary Scott 2021-07-20 12:18:06 +09:00 committed by GitHub
commit c0911e9a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,6 +47,13 @@ def purge_later
blob&.purge_later
end
# Returns an ActiveStorage::Variant or ActiveStorage::VariantWithRecord
# instance for the attachment with the set of +transformations+ provided.
# 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.
def variant(transformations)
case transformations
when Symbol