Fix SimpleForm bug when passing :name => nil as a options.

Since
f0a5d32537
if you pass :name => nil to an input it will not generate the automatic
name.

This issue was hidden because country_select has reimplemented
add_default_name_and_id on ActionView::Helpers::Tags::Base.
This commit is contained in:
Rafael Mendonça França 2012-12-27 13:03:46 -03:00
parent 3f185afa09
commit f991c8dd72
1 changed files with 4 additions and 3 deletions

View File

@ -49,9 +49,10 @@ module SimpleForm
# we need the hidden field to be *outside* the label (otherwise it
# generates invalid html - html5 only).
def build_hidden_field_for_checkbox
@builder.hidden_field(attribute_name, :value => unchecked_value, :id => nil,
:disabled => input_html_options[:disabled],
:name => input_html_options[:name])
options = { value: unchecked_value, id: nil, disabled: input_html_options[:disabled] }
options[:name] = input_html_options[:name] if input_html_options.has_key?(:name)
@builder.hidden_field(attribute_name, options)
end
def inline_label