File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/action_view/helpers/tags Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,12 @@ def render
37
37
# [nil, []]
38
38
# { nil => [] }
39
39
def grouped_choices?
40
- !@choices . blank? && @choices . first . respond_to? ( :second ) && Array === @choices . first . second
40
+ return false if @choices . blank?
41
+
42
+ first_choice = @choices . first
43
+ return false unless first_choice . is_a? ( Enumerable )
44
+
45
+ first_choice . second . is_a? ( Array )
41
46
end
42
47
end
43
48
end
Original file line number Diff line number Diff line change @@ -537,6 +537,13 @@ def test_select
537
537
)
538
538
end
539
539
540
+ def test_select_with_class
541
+ assert_dom_equal (
542
+ "<select name=\" post[class]\" id=\" post_class\" ><option value=\" Struct::Post\" >Struct::Post</option></select>" ,
543
+ select ( :post , :class , [ Post ] )
544
+ )
545
+ end
546
+
540
547
def test_select_without_multiple
541
548
assert_dom_equal (
542
549
"<select id=\" post_category\" name=\" post[category]\" ></select>" ,
You can’t perform that action at this time.
0 commit comments