Class: Spotlight::Resource

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

Overview

Exhibit resources

Direct Known Subclasses

Spotlight::Resources::Upload

Instance Method Summary collapse

Methods included from SolrDocument::AtomicUpdates

#reindex, #write?

Instance Method Details

#reindex_laterObject

Enqueue an asynchronous reindexing job for this resource



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

def reindex_later
  waiting!
  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



31
32
33
# File 'app/models/spotlight/resource.rb', line 31

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