Fields_for creates an array of fields. The "0" in the name represents the index in the array. Since you're creating new records you can simply ignore the hidden id field.
Fields_for creates an array of fields. The "0" in the name represents the index in the array. Since you're creating new records you can simply ignore the hidden id field.So via javascript you just need to do two things: 1.
Count the number of existing inputs for the child collection in order to get a new index. 2. Add a new text field using the new index.
This is relatively easy to do with jqery using a wildcard selector like $('inputname$="name"'). Length; to retrieve a count (for the new index). If you have another field for array with name fields you may want to use a regex selector instead (via plugin).
An easier way might be to just add a class to each of your skill name inputs and use that class as the selector when counting. To append the new input see: api.jquery.com/append/ If you're not using jquery, then it should be similar in other frameworks with a little googling.
Thank you very helpful ... I made it from your suggest – Joe May 3 at 9:54.
I have written a gem that can handle that makes handling nested forms dynamically easier: cocoon. The gem works with the standard rails formhelpers, but also with formtastic or simple_form. I would also advise you to checkout formtastic or simple_form, as those are awesome gems to make form-handling easier.
But as with HAML, that is a personal choice.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.