I'm trying to create a simple contact directory with two tables: Being one of them empresa :nome
and the other contatos :nome :telefone :email
... I created the two tables and placed a Foreign_key in the second one that will receive the first_ company. p>
In the form of the second table I put a f.collection_select
of the following%: <%= f.collection_select :empresa,Empresa.order('nome Asc'),:id, :nome,{prompt: "Selecione uma empresa"},{class: "form-control"} %>
. It works only that when I select the company and include the other fields the company id does not save in the Bank. Could you help me by telling me where I'm going wrong?