Search code examples
javascriptrubyformsruby-on-rails-3ujs

Rail 3 UJS complex forms multiple fields_for


I have a milestone with many tasks. On my project show page, I want to be able to create a milestone with however many tasks the user decides to add to the milestone. How do I add more tasks using

milestone_form.fields_for :tasks

?


Solution

  • Answered my question with a search for dynamically adding forms. And a little help from Ryan's scraps.

    https://github.com/alloy/complex-form-examples/blob/a234fde4419836f277d7e340657f1d8418911d68/app/views/projects/_form.html.erb#L40