From 804d313f90d460407a1c9c86363c86a75117d839 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 9 Mar 2018 11:52:28 +0100 Subject: [PATCH 1/2] Fix sample record creation [SCI-2145] --- app/controllers/samples_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index 459fbf445..1113c5435 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -68,7 +68,7 @@ class SamplesController < ApplicationController errors[:init_fields] = sample.errors.messages else # Sample was saved, we can add all newly added sample fields - params[:custom_fields].to_a.each do |id, val| + custom_fields_params.each do |id, val| scf = SampleCustomField.new( custom_field_id: id, sample_id: sample.id, From 853e1f76573403c5fb11e68a61665486ace451b4 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 9 Mar 2018 16:41:23 +0100 Subject: [PATCH 2/2] Fix nil case [SCI-2145] --- app/controllers/samples_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index 1113c5435..2871b73d3 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -68,7 +68,7 @@ class SamplesController < ApplicationController errors[:init_fields] = sample.errors.messages else # Sample was saved, we can add all newly added sample fields - custom_fields_params.each do |id, val| + custom_fields_params.to_a.each do |id, val| scf = SampleCustomField.new( custom_field_id: id, sample_id: sample.id,