# Nested Forms, has\_many

**URL:** <https://discuss.hotwired.dev/t/nested-forms-has-many/2166>\
**Category:** General\
**Created:** [January 29, 2021, 5:43pm UTC](https://discuss.hotwired.dev/t/nested-forms-has-many/2166 "2021-01-29T17:43:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanbruno](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/jonathanbruno/32/1215_2.png) [@jonathanbruno](https://discuss.hotwired.dev/u/jonathanbruno)\
**Post date:** [January 29, 2021, 5:43pm UTC](https://discuss.hotwired.dev/t/nested-forms-has-many/2166/1 "2021-01-29T17:43:33Z")

</div>

I’m trying to test turbo-frame/stimulus with a CRUD order/items scenario.  
I have an order with many items, in the ‘past’ we could use the [cocoon](https://github.com/nathanvda/cocoon) gem to add new items. If I’m not mistaken it holds a hidden item form html, and whenever the user adds a new item it basically creates new elements copying this item form. It has some limitations but works.

I’m expecting hotwire to bring a new approach for cases like that, maybe a fresh and different way of thinking…  
Would you guys use hotwire to add/edit/delete new items ? should/could I go to the back end to bring the item form ? or adding the form with stimulus fits better?

I haven’t came up with any idea ( maybe one or two ), so if you guys have some thoughts on that, it would be greate

---

<div class="post-metadata">

**Author:** ![minimul](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/minimul/32/1505_2.png) [@minimul](https://discuss.hotwired.dev/u/minimul)\
**Post date:** [January 29, 2021, 6:02pm UTC](https://discuss.hotwired.dev/t/nested-forms-has-many/2166/2 "2021-01-29T18:02:17Z")

</div>

> **[Rails Nested Form](https://stimulus-components.netlify.app/docs/components/stimulus-rails-nested-form/)**
>
> A Stimulus controller to create new fields on the fly to populate your Rails relationship with accepts\_nested\_attributes\_for.

---

<div class="post-metadata">

**Author:** ![aurels](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/aurels/32/1623_2.png) [@aurels](https://discuss.hotwired.dev/u/aurels)\
**Post date:** [February 10, 2021, 3:54pm UTC](https://discuss.hotwired.dev/t/nested-forms-has-many/2166/3 "2021-02-10T15:54:02Z")

</div>

I was wondering the same thing. A way to do that with just appending an “item” partial in the form without JS would be awesome. I’ll look into that @jonathanbruno !
