calebhearth / formulaic

Simplify form filling with Capybara
MIT License
552 stars 29 forks source link

Nested forms support #27

Closed zamith closed 10 years ago

zamith commented 10 years ago

Does formulaic support nested forms? Is it going to?

Thanks

calebhearth commented 10 years ago

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.

zamith commented 10 years ago

Yup. That works. Thanks.

calebhearth commented 10 years ago

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

zamith commented 10 years ago

Sure. I'll do that.