FIX: Allow setting an array custom field to a singleton value (#24636)

Also, validation happens per item in an array field.
This commit is contained in:
Daniel Waterworth
2023-11-29 14:18:47 -06:00
committed by GitHub
parent eef93ac926
commit 434ae5bbe7
2 changed files with 9 additions and 9 deletions

View File

@ -134,6 +134,13 @@ RSpec.describe HasCustomFields do
expect(db_item.custom_fields).to eq("a" => "b", "c" => "d")
end
it "handles assigning singleton values to array fields" do
CustomFieldsTestItem.register_custom_field_type "array", [:integer]
test_item = CustomFieldsTestItem.new
test_item.custom_fields = { "array" => "1" }
test_item.save
end
it "handles arrays properly" do
CustomFieldsTestItem.register_custom_field_type "array", [:integer]
test_item = CustomFieldsTestItem.new