mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge pull request #1927 from bogdan/select_multiple_index
Fixed ActionView::FormOptionsHelper#select with :multiple => false
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user