nested_attributes and fields_for and ajax

Hello there, I have a form_for and a fields_for within the form_for. I
want to add/delete item in the fields_for and refresh the items in the
fields_for list without having to regenerate the whole form.

Now, if I set up link_to_remotes for adding/deleting the item in
fields_for, it calls the controller, with the proper item to add/
delete, but what do I do to refresh the items in the fields_for after
the collection has been modified? Because the fields_for fields are
part of nested_attributes, how do I tell the view what the new
collection is to generate? Is there a way to convert a collection in a
controller to a fields_for collection, so the view can process it?

This has been frustrating to figure out...

Hi... you might want to take a look at:


Both of these are interesting sample apps loaded with good coding
ideas. I don't believe either of them uses AJAX or link_to_remote
exactly the way you intended, but at least they might give you some
new ideas and/or lead you in the right direction.

- pat

These are good examples of using form_for/fields_for nested
attributes, which I have no problems with. It's integrating Ajax with
fields_for which is causing pain.