Hi, forst at all sorry if my english is not the best. I have a problem
with a form. I use REST routes, encuestas has_many preguntas and
preguntas belongs_to encuesta and has_many votados.
I want to show in a form all the respuestas in one encuesta. I tried
with this
<%form_for [@encuesta, @preguntas] do |f|%>
hola
<%- end -%>
But it doesn´t work. This is the error:
RuntimeError in Encuestas#show
Showing encuestas/show.html.erb where line #10 raised:
Called id for nil, which would mistakenly be 4 – if you really wanted
the id of nil, use object_id
Extracted source (around line #10):
7: Permalink:
8: <%=h @encuesta.permalink %>
9:
10: <%form_for [@encuesta, @preguntas] do |f|%>
11:
12: hola
13:
If i try with something like this:
<%for pregunta in @encuesta.preguntas %>
hello
<%end%>
I can see hello so many times like preguntas are in encuesta. But i need
a form_for.
Anybody can help me please?