Skip to content

Commit

Permalink
Temporarily add transformer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gazayas committed Aug 8, 2023
1 parent c3a19a0 commit 301e5be
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bullet_train-super_scaffolding/lib/scaffolding/transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,22 @@ def valid_#{collection_name}
field_options[:color_picker_options] = "t('#{child.pluralize.underscore}.fields.#{name}.options')"
end

# When rendering a super_select element we need to use `html_options: {multiple: true}`,
# but all other fields simply use `multiple: true` to work.
if is_multiple
if type == "super_select"
field_options[:multiple] = "true"
else
field_attributes[:multiple] = "true"
end
end

valid_values = if is_id
"valid_#{name_without_id.pluralize}"
elsif is_ids
"valid_#{collection_name}"
end

field_options[:multiple] = "true" if is_multiple

# https://stackoverflow.com/questions/21582464/is-there-a-ruby-hashto-s-equivalent-for-the-new-hash-syntax
if field_options.any? || options.any?
field_options_key = if ["buttons", "super_select", "options"].include?(type)
Expand Down

0 comments on commit 301e5be

Please sign in to comment.