You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I tried check if a variant exists for a ActiveStorage::Attachment given but for my surprise this check doesn't exist.
Search further I found how check it:
# For example, a Entity model which has that declaration:has_many_attached:imagesdo |attachable|
attachable.variant:high,resize_to_limit: [1080,1080],format: :webp,saver: {strip: true}attachable.variant:low,resize_to_limit: [256,256],format: :png,saver: {strip: true,quality: 80}end# It's possible to get like thisEntity.attachment_reflections["images"].named_variants.keys# => [:high, :low]
So, isn't clear if make sense for everyone a method like #variant?(:low)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Today I tried check if a variant exists for a
ActiveStorage::Attachmentgiven but for my surprise this check doesn't exist.Search further I found how check it:
So, isn't clear if make sense for everyone a method like
#variant?(:low)Beta Was this translation helpful? Give feedback.
All reactions