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



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

def document_model
  exhibit.blacklight_config.document_model if exhibit
end

#reindex_laterObject

Enqueue an asynchronous reindexing job for this resource



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

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



27
28
29
# File 'app/models/spotlight/resource.rb', line 27

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