Rails and simple_form, filter values to fill a combobox

Asked

Viewed 130 times

0

There are three tables, one call enterprise, another group and a call subgroup, there is a field loan in this two, the last has the field group_id, a form, in this form use the simple_form to show a combobox with the groups, but come all groups and need to filter the groups of each company, how to do?

1 answer

0


Answering my own question :-p

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.