Skip to content

Commit c0911e9

Browse files
authored
Merge pull request rails#42740 from dmarcoux/document-active_storage-attachment-variant
Document ActiveStorage::Attachment#variant
2 parents a6223bb + 1cfeca9 commit c0911e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

activestorage/app/models/active_storage/attachment.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def purge_later
4747
blob&.purge_later
4848
end
4949

50+
# Returns an ActiveStorage::Variant or ActiveStorage::VariantWithRecord
51+
# instance for the attachment with the set of +transformations+ provided.
52+
# See ActiveStorage::Blob::Representable#variant for more information.
53+
#
54+
# Raises an +ArgumentError+ if +transformations+ is a +Symbol+ which is an
55+
# unknown pre-defined variant of the attachment.
56+
5057
def variant(transformations)
5158
case transformations
5259
when Symbol

0 commit comments

Comments
 (0)