diff --git a/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb b/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb index 140741e7d..647886d50 100644 --- a/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb +++ b/bullet_train-super_scaffolding/lib/scaffolding/transformer.rb @@ -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)