Add all Select Box solver groups

Asked

Viewed 27 times

0

I have a Select Box with some solver groups and a button to add them to the bank. By clicking 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.

Follow 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 %>

1 answer

0

Buddy, you’re 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 got a little fuzzy, so if you could clear it up, I’d appreciate it.

I hope I’ve helped :)

Browser other questions tagged

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