On Oct 26, 2011, at 11:53 AM, JavierQQ 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
I haven't followed that particular tutorial, but I have used the Railscasts (73
- 75) and Ryan Bates' fabulous nested_form gem. Note that the 'casts show how
to do it long-hand, and the gem simply wraps up all that work and puts a bow on
it. You can probably simply follow the directions from the gem and get on with
your life if you already know the theory.
Walter
>
> 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)
> 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.
>
--
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.