Thanks for your reply, I've seen that cast, but when I add another form for another children the HTML shows this
<input id="user_children_attributes_0_name" maxlength="255" name="user[children_attributes][0][name]" type="text"> so it's not increasing and it will only save the first child and now I'm trying what the cast says _children.html.erb <%= f.semantic_fields_for "user[children][]", user do |children| %> ..... <% end %> and I get this undefined local variable or method `user' It's maybe something I'm not seeing, I'm starting with rails and I hope someone can help me Thanks On Wed, Oct 26, 2011 at 11:06 AM, Colin Law <[email protected]> wrote: > On 26 October 2011 16:53, JavierQQ <[email protected]> wrote: > > Hello, > > > > I'm having some trouble with forms, my app allows to enter data by > > using a multi-step form that has 7 steps. > > There are 3 steps that may let the user to add 1 form, for example > > there's a step called "children" > > and that children has the following fields: > > * name > > * age > > * gender > > but one father may have more than 1 child and I'm adding another form > > with ajax by following this > > > http://stackoverflow.com/questions/4812003/adding-fields-dynamically-in-a-nested-model-form-in-rails-3 > > > > in the "invite" partial > > _invite.html.erb > > <%= fields_for "user[invites_attributes][]", invite do |i| %> > > <li> > > <%= link_to("Remove", "#delete", :class => "delete-invite") %> > > <%= i.label :full_name, "Full Name" %> > > <%= i.text_field :full_name %> > > <%= i.label :email, "Email Address" %> > > <%= i.text_field :email %> > > </li> > > <% end %> > > > > I'm having some troubles with the first line: <%= fields_for > > "user[invites_attributes][]", invite do |i| %> > > What is the correct usage of that? I'm using formtastic and when I > > made that line but with my fields > > > > <%= f.semantic_fields_for ("user[children_attributes][]", user) > > You should not have a space between semantic_fields_for and (. That > is ruby syntax. Whether it fixes you problem is another matter. > > Colin > > > do |fes| %> > > > > and I get this error > > > > ............... unexpected ',', expecting ')' > > > > I hope someone can help > > > > Thanks in advance > > > > -- > > 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. > > > > > > > > -- > gplus.to/clanlaw > > -- > 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. > > -- 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.

