class RailsAdmin::Config::Fields::Types::ActiveStorage

Public Instance Methods

resource_url(thumb = false) click to toggle source
# File lib/rails_admin/config/fields/types/active_storage.rb, line 48
def resource_url(thumb = false)
  return nil unless value

  if thumb && value.representable?
    thumb = thumb_method if thumb == true
    representation = value.representation(thumb)
    Rails.application.routes.url_helpers.rails_blob_representation_path(
      representation.blob.signed_id, representation.variation.key, representation.blob.filename, only_path: true
    )
  else
    Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true)
  end
end
value() click to toggle source
Calls superclass method RailsAdmin::Config::Fields::Base#value
# File lib/rails_admin/config/fields/types/active_storage.rb, line 62
def value
  attachment = super
  attachment if attachment&.attached?
end