Class: Spotlight::Resource

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ActiveModel::Callbacks
Defined in:
app/models/spotlight/resource.rb

Overview

Exhibit resources

Instance Method Summary collapse

Instance Method Details

#document_modelObject



44
45
46
# File 'app/models/spotlight/resource.rb', line 44

def document_model
  exhibit&.blacklight_config&.document_model
end

#reindex_later(**args) ⇒ Object

Enqueue an asynchronous reindexing job for this resource



40
41
42
# File 'app/models/spotlight/resource.rb', line 40

def reindex_later(**args)
  Spotlight::ReindexJob.perform_later(self, **args)
end

#save_and_index(reindex_options: {}, **args) ⇒ Object

Persist the record to the database, and trigger a reindex to solr

Parameters:

  • All (Hash)

    arguments will be passed through to ActiveRecord’s #save method



34
35
36
# File 'app/models/spotlight/resource.rb', line 34

def save_and_index(reindex_options: {}, **args)
  save(*args) && reindex_later(**reindex_options)
end