Permalink
Browse files

Fixed ActionView::FormOptionsHelper#select with :multiple => false

  • Loading branch information...
1 parent 539752a commit 0fdac01876c37c692e9107b6120e03aec692663d @bogdan bogdan committed Jun 30, 2011
@@ -1153,7 +1153,7 @@ def add_default_name_and_id(options)
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
@@ -378,6 +378,13 @@ def test_select
)
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

0 comments on commit 0fdac01

Please sign in to comment.