ryanb / nested_form

Rails plugin to conveniently handle multiple models in a single form.
MIT License
1.79k stars 505 forks source link

How do I remove the initial second nested field when edit? #291

Closed Monclee closed 10 years ago

Monclee commented 10 years ago

Ok when the user post its ok, but when he edits by default a new field is added, like he has clicked "add more" when he does not. how can i remove this?

lest commented 10 years ago

I guess you don't need to build a new nested record if there are some present. E.g.:

@project.tasks.build unless @project.tasks.any?