I need that when sending the data of a form, automatically send the data of another form creating a record in another table in the database, it is worth noting that both records do not have a direct relationship.
these would be the two forms
<%= form_for(@relcliruta, remote: true, html: {class: "form-horizontal"}) do |f| %> <!--ajax remote: true-->
<div class="field">
<%= f.hidden_field :IdRuta, value: params[:id] %>
</div>
<div class="field">
<%= f.hidden_field :IdCliente, value: cliente.id%>
</div>
<div class="field">
<%= f.hidden_field :IdEmpresa, value: current_usuario.empresa_id %>
</div>
</div>
<%= submit_tag "Añadir", class: "btn btn-warning btn-xs"%>
<%end%>
<%= form_for(@reldayc, remote: true, html: {class: "form-horizontal"}) do |f| %> <!--ajax remote: true-->
<%= f.hidden_field :RutaId, value: params[:id] %>
<%= f.hidden_field :CodCli, value: cliente.id%>
<%= f.hidden_field :IdEmpresa, value: current_usuario.empresa_id %>
<%end%>
I need that when creating one, the other one is created.