From eb5b63cd460778e639c0f109eb20a24503be7b58 Mon Sep 17 00:00:00 2001 From: Lucas Mazza Date: Tue, 10 Dec 2013 14:29:37 -0200 Subject: [PATCH] Don't render the `boolean_style` as an HTML attribute on `input_field`. --- README.md | 2 +- lib/simple_form/form_builder.rb | 2 +- test/form_builder/input_field_test.rb | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 741d2aad..f8273e36 100644 --- a/README.md +++ b/README.md @@ -279,7 +279,7 @@ end ... - + ``` diff --git a/lib/simple_form/form_builder.rb b/lib/simple_form/form_builder.rb index 44ae509e..420c44aa 100644 --- a/lib/simple_form/form_builder.rb +++ b/lib/simple_form/form_builder.rb @@ -137,7 +137,7 @@ module SimpleForm # def input_field(attribute_name, options={}) options = options.dup - options[:input_html] = options.except(:as, :collection, :label_method, :value_method, *ATTRIBUTE_COMPONENTS) + options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *ATTRIBUTE_COMPONENTS) options = @defaults.deep_dup.deep_merge(options) if @defaults SimpleForm::Wrappers::Root.new(ATTRIBUTE_COMPONENTS + [:input], wrapper: false).render find_input(attribute_name, options) diff --git a/test/form_builder/input_field_test.rb b/test/form_builder/input_field_test.rb index 755ad85b..bccd28a3 100644 --- a/test/form_builder/input_field_test.rb +++ b/test/form_builder/input_field_test.rb @@ -122,4 +122,12 @@ class InputFieldTest < ActionView::TestCase assert_no_select 'select.status[label_method]' assert_no_select 'select.status[value_method]' end + + test 'build input_field does not treat "boolean_style" as an HTML attribute' do + with_concat_form_for(@user) do |f| + f.input_field :active, boolean_style: :nested + end + + assert_no_select 'input.boolean[boolean_style]' + end end