Rails and simple_form, filter values to populate a combobox

0

There are three tables, one called company , another group and a subgroup call, / em> , a form, in this form I use simple_form to show a combobox with groups, but all come the groups and need to filter the groups of each company, how to do?

    
asked by anonymous 20.02.2017 / 13:52

1 answer

0

Answering my own question :-p

= f.association :group, 
                collection: Group.where('company_id = ?', current_user.company_id), selected: @subgroup.group_id
    
20.02.2017 / 14:21