diff --git a/lib/simple_form/form_builder.rb b/lib/simple_form/form_builder.rb index 9a4fed44..0147d784 100644 --- a/lib/simple_form/form_builder.rb +++ b/lib/simple_form/form_builder.rb @@ -140,7 +140,7 @@ module SimpleForm components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS) options = options.dup - options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *components) + options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, :prompt, *components) options = @defaults.deep_dup.deep_merge(options) if @defaults input = find_input(attribute_name, options) diff --git a/test/form_builder/input_field_test.rb b/test/form_builder/input_field_test.rb index e628c6a3..a017cbe4 100644 --- a/test/form_builder/input_field_test.rb +++ b/test/form_builder/input_field_test.rb @@ -121,6 +121,12 @@ class InputFieldTest < ActionView::TestCase assert_no_select 'input.boolean[boolean_style]' end + test 'build input_field does not treat "prompt" as a HTML attribute' do + with_input_field_for @user, :attempts, collection: [1,2,3,4,5], prompt: :translate + + assert_no_select 'select[prompt]' + end + test 'build input_field without pattern component use the pattern string' do swap_wrapper :default, custom_wrapper_with_html5_components do with_input_field_for @user, :name, pattern: '\w+'