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, old_slug = nil, new_slug = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/jobs/spotlight/rename_sidecar_field_job.rb', line 10 def perform(exhibit, old_field, new_field, old_slug = nil, new_slug = nil) exhibit.solr_document_sidecars.find_each do |s| # this data migration should be relatively rare migrate_data!(s, old_slug, new_slug) migrate_data!(s, old_field, new_slug || new_field) # for backwards compatibility # more likely, the indexing rules changed and we have to reindex reindex_document!(s) if old_field != new_field && s.data[new_slug || new_field] end end |