Hey,

  Please refer to correct usage of form_for:
API: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
with examples:
http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for

On Fri, Mar 13, 2009 at 1:21 PM, Jose vicente Ribera pellicer <
[email protected]> wrote:

>
> 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:   <b>Permalink:</b>
> 8:   <%=h @encuesta.permalink %>
> 9: </p>
> 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?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
-- 
Thanks & Regards,
Sumanth Krishna. A
+358 40 3276564

Blogs:
                        TwinclingCommunity:

http://sumanthtechsavvy.blogspot.com/
         http://www.twincling.org/node/227

http://yourway2health.blogspot.com/
           http://www.osef.twincling.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to