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



48
49
50
# File 'app/models/spotlight/resource.rb', line 48

def document_model
  exhibit&.blacklight_config&.document_model
end

#reindex_later(**args) ⇒ Object

Enqueue an asynchronous reindexing job for this resource



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

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



38
39
40
# File 'app/models/spotlight/resource.rb', line 38

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