Module: GeoblacklightSidecarImages::SolrDocumentBehavior

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/geoblacklight_sidecar_images/solr_document_behavior.rb

Instance Method Summary collapse

Instance Method Details

#ogm_thumbnail_urlObject



7
8
9
# File 'app/models/concerns/geoblacklight_sidecar_images/solr_document_behavior.rb', line 7

def ogm_thumbnail_url
  GeoblacklightSidecarImages::OgmThumbnail.url_for(self)
end

#sidecarObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/concerns/geoblacklight_sidecar_images/solr_document_behavior.rb', line 11

def sidecar
  record = SolrDocumentSidecar.find_or_initialize_by(
    document_id: id,
    document_type: self.class.to_s
  )
  version = _source["_version_"]
  if record.new_record? || record.version != version
    record.version = version
    record.save!
  end
  record
end