I want to create a nested multi select in formtastic from two objects like this –
Option 1
Option A
Option B
Option C
Option 2
Option A
Option B
Option C
list1 = ['option1', 'option2']
list2 = ['Option A', 'Option B', 'Option C']
Is this possible with formtastic or is it better to use a helper to format the data ?
Thanks, Alex
It’s possible, you have to use something like:
<%= f.input :input_field_name, :as => :select, :collection => grouped_options_for_select(['List 1', list1], ['List 2', list2]) %>Look up the Formtastic documentation for
input_selectand the Rails API forgrouped_options_for_selectfor other possible formatting options.