Sha256: 6702981b7b3a14a42c4448fc9fdb4db1d22fde92f0b7632c770b2eaf5b51c8bc

Contents?: true

Size: 539 Bytes

Versions: 9

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # After renaming an exhibit-specific field, we also
  # need to update the sidecars that may contain that field
  class RenameSidecarFieldJob < ActiveJob::Base
    queue_as :default

    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-2.7.2 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.7.1 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.7.0 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.6.1.1 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.6.1 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.6.0 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.5.2 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.5.1 app/jobs/spotlight/rename_sidecar_field_job.rb
blacklight-spotlight-2.5.0 app/jobs/spotlight/rename_sidecar_field_job.rb