目前我正在使用grouped_options_for_select来显示我的rails项目中的某些类别。代码
collection = ["North America",[["United States",["inner"]],["Canada",["inner"]]]]
<%= select_tag(::id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %>
此输出如下
North America
United States inner
Canada
inner
但希望输出如下
North America
United Sates
inner
Canada
inner
我该怎么做?
答案 0 :(得分:0)
试试这个: -
collection = ["North America",["United States",["inner"]],["Canada",["inner"]]]
<%= select_tag(:id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %>