Class: ActiveStorage::AsyncVariants::StatesController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/active_storage/async_variants/states_controller.rb

Constant Summary collapse

TRANSPARENT_GIF =

1x1 transparent GIF served at a filename-bearing URL, so the processing/failed <img> identifies its media without fetching anything.

"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7".unpack1("m").freeze

Instance Method Summary collapse

Instance Method Details

#placeholderObject



23
24
25
26
# File 'app/controllers/active_storage/async_variants/states_controller.rb', line 23

def placeholder
  expires_in 1.year, public: true
  send_data TRANSPARENT_GIF, type: "image/gif", disposition: "inline"
end

#retryObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/active_storage/async_variants/states_controller.rb', line 28

def retry
  @variant.blob.variant_records.where(
    variation_digest: @variant.variation.digest,
    state: "failed",
  ).destroy_all
  @variant.enqueue!

  redirect_to Rails.application.routes.url_helpers.async_variant_state_path(
    signed_blob_id: params[:signed_blob_id],
    variation_key: params[:variation_key],
    kind: params[:kind],
    direct: params[:direct],
    opts: async_variant_html_options.presence,
  ), status: :see_other
end

#showObject



20
21
# File 'app/controllers/active_storage/async_variants/states_controller.rb', line 20

def show
end