Module: Spotlight::SolrDocument::UploadedResource

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/spotlight/solr_document/uploaded_resource.rb

Overview

Mixin for SolrDocuments backed by exhibit-specific resources

Instance Method Summary collapse

Instance Method Details

#to_openseadragon(*_args) ⇒ Object



19
20
21
# File 'app/models/concerns/spotlight/solr_document/uploaded_resource.rb', line 19

def to_openseadragon(*_args)
  [uploaded_resource.upload.iiif_tilesource] if uploaded_resource && uploaded_resource.upload
end

#uploaded_resourceObject



12
13
14
15
16
17
# File 'app/models/concerns/spotlight/solr_document/uploaded_resource.rb', line 12

def uploaded_resource
  @uploaded_resource ||= GlobalID::Locator.locate first(Spotlight::Engine.config.resource_global_id_field)
rescue => e
  Rails.logger.info("Unable to locate uploaded resource: #{e}")
  nil
end