Add all solver groups in the Select Box

0

I have a Select Box with some solver groups and a button to add them to the bank. When I click the button, I add the solver group to the bank. But this is done one at a time. I would like to do this all at once.

Here is my code below:

<%= form_for(@solver_group_user, url: admin_user_create_permission_contract_group_path, html: {class: 'ui form'}) do |f| %>
  <div class="two fields">
    <div class="fifteen wide field">
      <%= f.select(
        :solver_group_id,
        options_for_select(SolverGroup.where(contract: @contract, enable: 1).where.not(id: @user.solver_group).order(:name).map{
          |v| [v.name, v.id]
        }),
        {},
        {class: 'ui dropdown search menu_dropdown'}
      ) %>
    </div>

    <%= f.hidden_field :user_id, value: @user.id %>
    <div class="two wide field">
      <%= button_tag(type: 'submit', class: 'circular small ui blue icon button') do %>
        <i class="icon save"></i>
      <% end %>
    </div>
  </div>
<% end %>
    
asked by anonymous 24.12.2015 / 12:48

1 answer

0

Friend, are you using nested_attributes to pass the parameters?

Try the following

def solver_group_user_params
 params(:solver_group_user).require(:seus_campos, solver_group_attributes: [])
end

It was kind of confusing, so if you can get some clarification, thank you.

I hope I have helped:)

    
27.01.2016 / 03:03