Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 0fdac01876c37c692e9107b6120e03aec692663d 1 parent 539752a
Bogdan Gusiev bogdan authored
2  actionpack/lib/action_view/helpers/form_helper.rb
View
@@ -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
7 actionpack/test/template/form_options_helper_test.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.