diff --git a/app/models/dialog_field_tag_control.rb b/app/models/dialog_field_tag_control.rb index 6342427b264..b69e8d4bafb 100644 --- a/app/models/dialog_field_tag_control.rb +++ b/app/models/dialog_field_tag_control.rb @@ -29,6 +29,10 @@ def force_single_value=(setting) options[:force_single_value] = setting end + def force_multi_value + !single_value? + end + def self.allowed_tag_categories tag_cats = Classification.where(:show => true, :parent_id => 0, :read_only => false).includes(:tag).to_a diff --git a/spec/models/dialog_field_tag_control_spec.rb b/spec/models/dialog_field_tag_control_spec.rb index 42efa99e6b9..9eaae843236 100644 --- a/spec/models/dialog_field_tag_control_spec.rb +++ b/spec/models/dialog_field_tag_control_spec.rb @@ -36,6 +36,13 @@ def add_entry(cat, options) expect(@df.single_value?).to be_truthy end + it "#force_multi_value" do + expect(@df.force_multi_value).to be_truthy + + @df.force_single_value = true + expect(@df.force_multi_value).to be_falsey + end + it "#automate_key_name" do expect(@df.automate_key_name).to eq("Array::dialog_#{@df.name}") end