Class: Spotlight::Resource
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::Resource
show all
- Extended by:
- ActiveModel::Callbacks
- Includes:
- ActiveSupport::Benchmarkable
- Defined in:
- app/models/spotlight/resource.rb
Overview
Instance Method Summary
collapse
Instance Method Details
#document_model ⇒ Object
65
66
67
|
# File 'app/models/spotlight/resource.rb', line 65
def document_model
exhibit.blacklight_config.document_model if exhibit
end
|
#enqueued_at ⇒ Object
53
54
55
|
# File 'app/models/spotlight/resource.rb', line 53
def enqueued_at
cast_to_date_time(super)
end
|
#enqueued_at? ⇒ Boolean
57
58
59
|
# File 'app/models/spotlight/resource.rb', line 57
def enqueued_at?
enqueued_at.present?
end
|
#last_indexed_finished ⇒ Object
61
62
63
|
# File 'app/models/spotlight/resource.rb', line 61
def last_indexed_finished
cast_to_date_time(super)
end
|
#reindex_later ⇒ Object
Enqueue an asynchronous reindexing job for this resource
43
44
45
46
|
# File 'app/models/spotlight/resource.rb', line 43
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
37
38
39
|
# File 'app/models/spotlight/resource.rb', line 37
def save_and_index(*args)
save(*args) && reindex_later
end
|
#waiting! ⇒ Object
48
49
50
51
|
# File 'app/models/spotlight/resource.rb', line 48
def waiting!
update(enqueued_at: Time.zone.now)
super
end
|