Hi
I have a task model which has a habtm association with documents, I want the user to be able to upload new documents and automatically associate those documents with the task and also be able to select existing documents to link or unlink with the task
I've tried using the nested attributes code and the habtm checkbox code from rails casts
- episodes/196-nested-model-form-part-1
- episodes/197-nested-model-form-part-2
- episodes/17-habtm-checkboxes
but after running ruby-debug it appears as if runs the nested attributes first and then when it comes to assign the checkbox documents they overwrite any newly added documents
Any ideas how I can create a form where I can link, unlink and create new models from a habtm association on the same form?
====
Updated
I've found a quick hack for now is to create a new habtm association for the newly added records using the nested forms called new_documents, then they dont overwrite each other
But I'd still like to know what the rails way of doing this is