Class: RailsAdmin::Config::Fields::Types::MultipleActiveStorage::ActiveStorageAttachment

Inherits:
RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment show all
Defined in:
lib/rails_admin/config/fields/types/multiple_active_storage.rb

Instance Attribute Summary

Attributes inherited from RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment

#value

Instance Method Summary collapse

Methods inherited from RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment

#initialize

Methods included from Configurable

#has_option?, #register_deprecated_instance_option, #register_instance_option

Methods included from Proxyable

#bindings, #bindings=, #with

Constructor Details

This class inherits a constructor from RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment

Instance Method Details

#resource_url(thumb = false) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rails_admin/config/fields/types/multiple_active_storage.rb', line 25

def resource_url(thumb = false)
  return nil unless value
  if thumb && value.variable?
    variant = value.variant(thumb_method)
    Rails.application.routes.url_helpers.rails_blob_representation_path(
      variant.blob.signed_id, variant.variation.key, variant.blob.filename, only_path: true
    )
  else
    Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true)
  end
end