Don't render the `boolean_style` as an HTML attribute on `input_field`.

This commit is contained in:
Lucas Mazza 2013-12-10 14:29:37 -02:00
parent d01f3e261c
commit eb5b63cd46
3 changed files with 10 additions and 2 deletions

View File

@ -279,7 +279,7 @@ end
...
<input class="string required" id="user_name" maxlength="255" name="user[name]" size="255" type="text">
<input name="user[remember_me]" type="hidden" value="0">
<input boolean_style="inline" class="boolean optional" id="user_remember_me" name="user[remember_me]" type="checkbox" value="1">
<input class="boolean optional" id="user_remember_me" name="user[remember_me]" type="checkbox" value="1">
</form>
```

View File

@ -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)

View File

@ -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