diff --git a/app/models/spotlight/resources/upload.rb b/app/models/spotlight/resources/upload.rb index 6aaa0a5ae..59231109f 100644 --- a/app/models/spotlight/resources/upload.rb +++ b/app/models/spotlight/resources/upload.rb @@ -68,7 +68,7 @@ def sidecar_update_data end def custom_fields_data - data.slice(*exhibit.custom_fields.map(&:slug).map(&:to_s)).compact_blank + data.slice(*exhibit.custom_fields.map(&:field).map(&:to_s)).compact_blank end def configured_fields_data diff --git a/spec/controllers/spotlight/resources/upload_controller_spec.rb b/spec/controllers/spotlight/resources/upload_controller_spec.rb index a8a96e991..2687a957b 100644 --- a/spec/controllers/spotlight/resources/upload_controller_spec.rb +++ b/spec/controllers/spotlight/resources/upload_controller_spec.rb @@ -47,8 +47,8 @@ it 'can add multivalued fields' do field = FactoryBot.create(:custom_field, exhibit: exhibit, is_multiple: true) - post :create, params: { exhibit_id: exhibit, resources_upload: { data: { field.slug => %w[1 2 3] } } } - expect(assigns[:resource].sidecar.data).to include(field.slug => %w[1 2 3]) + post :create, params: { exhibit_id: exhibit, resources_upload: { data: { field.field => %w[1 2 3] } } } + expect(assigns[:resource].sidecar.data).to include(field.field => %w[1 2 3]) end end end diff --git a/spec/models/spotlight/resources/upload_spec.rb b/spec/models/spotlight/resources/upload_spec.rb index 38af191dc..2ee5b72af 100644 --- a/spec/models/spotlight/resources/upload_spec.rb +++ b/spec/models/spotlight/resources/upload_spec.rb @@ -74,8 +74,8 @@ end it 'the sidecar is updated with the appropriate data from custom fields' do - FactoryBot.create(:custom_field, exhibit: exhibit, slug: 'custom_field_1') - FactoryBot.create(:custom_field, exhibit: exhibit, slug: 'custom_field_2') + FactoryBot.create(:custom_field, exhibit: exhibit, field: 'custom_field_1') + FactoryBot.create(:custom_field, exhibit: exhibit, field: 'custom_field_2') expect(upload.sidecar).to receive(:update).with( data: hash_including('custom_field_1' => 'Custom Field 1 Data', 'custom_field_2' => 'Custom Field 2 Data')