Skip to content

Commit

Permalink
Forcing default_value to an array, if the dynamic dropdown is multise…
Browse files Browse the repository at this point in the history
  • Loading branch information
romanblanco committed Apr 10, 2018
1 parent c9e7f02 commit 81f942f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/dialog_field_radio_button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def initial_values
[[nil, "<None>"]]
end

def force_multi_value
false
end

private

def raw_values
Expand Down
3 changes: 3 additions & 0 deletions app/models/dialog_field_sorted_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def sort_data(data_to_sort)
end

def determine_selected_default_value
if dynamic? && force_multi_value && !default_value.kind_of?(Array)
self.default_value = Array.wrap(default_value)
end
use_first_value_as_default unless default_value_included?(@raw_values)
self.value ||= default_value.nil? && data_type == "integer" ? nil : default_value.send(value_modifier)
end
Expand Down

0 comments on commit 81f942f

Please sign in to comment.