I am using the Rails html helper to create a simple html structure with a label, a select and optgroups (this is the only slightly complicated part).
I then created a helper called resources_optgroup. I want an output like this:
<div>
<label>Something</label>
<select name="something">
<optgroup label="something">
<option value="1">something</option>
<option value="2">something</option>
<option value="3">something</option>
</optgroup>
<optgroup label="something">
<option value="1">something</option>
<option value="2">something</option>
<option value="3">something</option>
</optgroup>
</select>
</div>
And this is my Rails code. I can't make both,the label and the select tags to work together. What is this?
def collection_link(item,site)
content_tag :div, class: '' do
label_tag item['title']
content_tag(:select) do
concat resources_optgroup site, Page
concat resources_optgroup site, Category
concat resources_optgroup site, Post
concat resources_optgroup site, Product
concat resources_optgroup site, Service
end
end
end