@usuarios is nil when you post the forms and there are validation errors (you're not reloading them a the create action), here's how to solve it:
<%=collection_select(:usuario, :id, Usuario.all, :id, :nome_completo)%>
@usuarios is nil when you post the forms and there are validation errors (you're not reloading them a the create action), here's how to solve it:
<%=collection_select(:usuario, :id, Usuario.all, :id, :nome_completo)%>
thanks! I got it working like this: http://disciplinas.dcc.ufba.br/svn/MATA76/Trabalho20091/equipe13/trunk/lac/app/views/vendas/_form.html.erb?view=log
The problem is with nested models through ajax. When submit button is hitted, it claims that I didn't choose a credit card(cartao_de_credito) for the payment(pagamento). How come? http://disciplinas.dcc.ufba.br/svn/MATA76/Trabalho20091/equipe13/trunk/lac/app/views/vendas/_pagamento.html.erb?view=log
you can browse all the code through svn pages
thanks! I got it working like this:http://disciplinas.dcc.ufba.br/svn/MATA76/Trabalho20091/equipe13/trun…
The problem is with nested models through ajax. When submit button is hitted, it claims that I didn't choose a credit card(cartao_de_credito) for the payment(pagamento). How come?http://disciplinas.dcc.ufba.br/svn/MATA76/Trabalho20091/equipe13/trun…
You're using collection_select wrong. EIther you use the form_builder version and do
f.collection_select :attribute_name, ...
or you use the old version:
collection_select :ivar_name, :attribute_name, ...
but not some mix of the two as you have there
Fred
Nice! It worked. Last thing is that I tried using select_tag in many ways, but none worked. By lines 9-12 in http://disciplinas.dcc.ufba.br/svn/MATA76/Trabalho20091/equipe13/trunk/lac/app/views/vendas/_pagamento.html.erb?view=log I just want a normal select tag with those 4 values.
Frederick Cheung wrote: