mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:37:44 +08:00
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:

committed by
GitHub

parent
eef93ac926
commit
434ae5bbe7
@ -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
|
||||
|
Reference in New Issue
Block a user