how Dynamically add fields in rails with out nested attributes
I am in the early stages of creating an app, and am just putting some basic code in place. Here is the current code…
Added more code to flesh this out. The issue I am having is the 3rd variable I am passing in on this line…
It does not like ‘:skill’, but I am not sure what I should be passing here.
So here is what I came up with…here are my two models…
I’m calling a partial from app/views/skills/_form.html.erb and using a js tag to add new fields. Also note that I am re-rendering the partial, then hiding it in the last div tag.
The partial is pretty simple. All I am doing here is storing the values in an array…
…and finally the controller action decontructs the arrays, and saves them…