Are active storage named variants still a thing?

the docs for active storage describe how you can create and use named variants:

class User < ApplicationRecord
  has_one_attached :avatar do |attachable|
    attachable.variant :thumb, resize: "100x100"
  end
end

#Call avatar.variant(:thumb) to get a thumb variant of an avatar:
<%= image_tag user.avatar.variant(:thumb) %>

when I try to do that, I just get an error

NoMethodError - undefined method deep_symbolize_keys’ for :thumb:Symbol:`

My suspicion is that rails 6 has thrown this functionality out. Is that correct?

I think it’s the other way around, it’s a new feature already visible in the edge guides you linked to, but not yet available in your version of Rails.

See [ActiveStorage] Add ability to use pre-defined variants by fatkodima · Pull Request #39135 · rails/rails · GitHub

1 Like

thank you.

It’s odd - I’m sure I remember seeing that functionality years ago, but perhaps it was paperclip or some other similar provider…

It’s where the idea comes from:

1 Like

Everything is in the DB so you could try to filter and delete the appropriate VariantRecords along with the associated Blobs and Attachments?