Class: Spotlight::Resource
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::Resource
- Extended by:
- ActiveModel::Callbacks
- Includes:
- ActiveSupport::Benchmarkable, SolrDocument::AtomicUpdates
- Defined in:
- app/models/spotlight/resource.rb
Overview
Exhibit resources
Direct Known Subclasses
Instance Method Summary collapse
- #becomes_provider ⇒ Object
- #needs_provider? ⇒ Boolean
-
#reindex_later ⇒ Object
Enqueue an asynchronous reindexing job for this resource.
-
#save_and_index(*args) ⇒ Object
Persist the record to the database, and trigger a reindex to solr.
Methods included from SolrDocument::AtomicUpdates
Instance Method Details
#becomes_provider ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/models/spotlight/resource.rb', line 25 def becomes_provider klass = Spotlight::ResourceProvider.for_resource(self) if klass self.becomes! klass else self end end |
#needs_provider? ⇒ Boolean
35 36 37 |
# File 'app/models/spotlight/resource.rb', line 35 def needs_provider? type.blank? end |
#reindex_later ⇒ Object
Enqueue an asynchronous reindexing job for this resource
49 50 51 |
# File 'app/models/spotlight/resource.rb', line 49 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
43 44 45 |
# File 'app/models/spotlight/resource.rb', line 43 def save_and_index(*args) save(*args) && reindex_later end |