Change attribute in link_to by a select

0

I have a select that a provider takes.

<%= form_for @claim do |f| %>
<%= f.select :provider_id, {}, {include_blank: "Seleccione opción"}, {id: "provider_selector_resend", style: "width:100%;"} %>
  

Then on the same page I have a link_to (which is in a show) that takes the data from it and duplicates it (dup)

<%= link_to "Reenviar", resend_claim_path(params[:id]), id: "resend_button", class: "button tiny", style: "margin-top: 12px;"%>

And the code of the dup in the controller:

def resend
  copy_claim = Claim.find(params[:id])
  @claim = copy_claim.dup
  @claim.items << copy_claim.items.map {|it| it.dup}
  @claim.updates << copy_claim.updates.map {|up| up.dup}
  @claim.client_id = current_user.company.id
  @claim.resend_id = copy_claim.id
  if @claim.save
    redirect_to :back
    flash[:success] = "Reenvío enviado con éxito"
  else
    flash[:notice]= "Error al reenviar el reclamo "
  end
end

My problem is that I want the link_to to take the select (which is a provider_id ) and replace it with the provider_id of the dup that it takes ( @claim = copy_claim.dup - You copy it here).

    
asked by Moises Donoso Salinas 01.12.2016 в 15:53
source

0 answers