Class: Spotlight::RenameSidecarFieldJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Spotlight::RenameSidecarFieldJob
- Defined in:
- app/jobs/spotlight/rename_sidecar_field_job.rb
Overview
After renaming an exhibit-specific field, we also need to update the sidecars that may contain that field
Instance Method Summary collapse
Instance Method Details
#perform(exhibit, old_field, new_field) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/jobs/spotlight/rename_sidecar_field_job.rb', line 8 def perform(exhibit, old_field, new_field) exhibit.solr_document_sidecars.find_each do |s| if s.data[old_field] s.data_will_change! s.data[new_field] = s.data.delete(old_field) s.save s.document.reindex end end end |