Merge pull request #1927 from bogdan/select_multiple_index

Fixed ActionView::FormOptionsHelper#select with :multiple => false
This commit is contained in:
José Valim
2011-07-01 04:31:48 -07:00
2 changed files with 8 additions and 1 deletions

View File

@@ -1153,7 +1153,7 @@ module ActionView
options["name"] ||= tag_name_with_index(@auto_index)
options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) }
else
options["name"] ||= tag_name + (options.has_key?('multiple') ? '[]' : '')
options["name"] ||= tag_name + (options['multiple'] ? '[]' : '')
options["id"] = options.fetch("id"){ tag_id }
end
end

View File

@@ -378,6 +378,13 @@ class FormOptionsHelperTest < ActionView::TestCase
)
end
def test_select_without_multiple
assert_dom_equal(
"<select id=\"post_category\" name=\"post[category]\"></select>",
select(:post, :category, "", {}, :multiple => false)
)
end
def test_select_with_boolean_method
@post = Post.new
@post.allow_comments = false