Class: Spotlight::Resource

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

Overview

Exhibit resources

Instance Method Summary collapse

Instance Method Details

#document_modelObject



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

def document_model
  exhibit.blacklight_config.document_model if exhibit
end

#reindex_laterObject

Enqueue an asynchronous reindexing job for this resource



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

def reindex_later
  Spotlight::ReindexJob.perform_later(self)
end

#save_and_index(*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



29
30
31
# File 'app/models/spotlight/resource.rb', line 29

def save_and_index(*args)
  save(*args) && reindex_later
end