instance method create_variants

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

create_variants()

No documentation comment.

Source
# File activestorage/app/models/active_storage/attachment.rb, line 205
    def create_variants
      return unless representable?

      immediate_variants = []
      later_variants     = []

      named_variants.each do |_name, named_variant|
        case named_variant.process(record)
        when :immediately
          # Skip if already processed from local io in uploaded()
          immediate_variants << named_variant.transformations unless immediate_variants_processed
        when :later
          later_variants << named_variant.transformations
        end
      end

      ActiveStorage::CreateVariantsJob.perform_now(blob, variants: immediate_variants, process: :immediately) if immediate_variants.any?
      ActiveStorage::CreateVariantsJob.perform_later(blob, variants: later_variants, process: :later) if later_variants.any?
    end

Defined in activestorage/app/models/active_storage/attachment.rb line 205 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Attachment

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close