calebhearth / formulaic

Simplify form filling with Capybara

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested forms support

zamith opened this issue · comments

Does formulaic support nested forms? Is it going to?

Thanks

Yes, but it's harder.

fill_form(:main_object, main_object_attributes)
fill_form(:nested_object, nested_object_attributes)

That should work because it uses the first argument only to find translations. It won't work when you have nested has_many relationships except with a within('#selector') block for each form / formset id. It's not pretty, and not an ideal use case.

If you can come up with a nicer way of doing this, I'm open to suggestions, but I'm skeptical that there are good solutions that remain backward compatible and not confusing.

Yup. That works. Thanks.

Sweet. Since you just got this working, do you want to add an example to the README of doing that?

Sure. I'll do that.