1
Guys, a little help here, please!
<%= form_tag(portabilizar_portabilidades_path, name: 'form', method: :get) do %>
<table class="table table-condensed table-bordered table-hover">
<thead>
<tr>
<th> </th>
<th>Nº do contrato</th>
<th>Nova parcela</th>
<th>Verba proponente</th>
<th>Ação</th>
</tr>
</thead>
<tbody>
<% @autorizacoes.each do |autorizacao| %>
<tr>
<td><%= radio_button_tag "autorizacao", autorizacao.id %></td>
<td><%= autorizacao.numero_contrato %></td>
<td>
<input class="string required form-control" placeholder="Digite um valor" type="text" name="nova_parcela" id="portabilidade_nova_parcela">
</td>
<td>
<%= collection_select( :portabilidade, :verba, Verba.all, :id, :descricao, {prompt: "Selecione a verba"}, {class: "form-control"} ) %>
</td>
<td><%= submit_tag "Portabilizar", :class => 'btn btn-primary btn-portabilizar', :disabled => true %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
This is my view and my controller is this:
def portabilizar
@autorizacao = Autorizacao.find(params[:autorizacao])
autorizacao_selecionada = params["autorizacao"].to_i
@nova_parcela = params[:nova_parcela].to_i
@verba_proponente = params[:portabilidade][:verba]
I just need that by clicking on my radiobutton, enter the value in the input, click the button and save the values. But this is only happening with the last record. The previous records are being saved as null, how to resolve this? I don’t know what I’m doing wrong.
I did that once. This generates a form for each authorization and the problem is that I will be able to mark several radiobuttons and can not be so... The solution everyone talks about is by a different name, type <input type="seu_type" name="model[N][attribute]">. However, I don’t know how to implement this in any way there in my controller...
– Elton Santos