# Question on creation with Many-to-Many relationships

**URL:** https://discuss.ihp.digitallyinduced.com/t/question-on-creation-with-many-to-many-relationships/77
**Category:** General
**Created:** [December 11, 2024, 12:59am UTC](https://discuss.ihp.digitallyinduced.com/t/question-on-creation-with-many-to-many-relationships/77 "2024-12-11T00:59:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nunocf](https://discuss.ihp.digitallyinduced.com/user_avatar/discuss.ihp.digitallyinduced.com/nunocf/32/43_2.png) [@nunocf](https://discuss.ihp.digitallyinduced.com/u/nunocf)
#### Post date: [December 11, 2024, 12:59am UTC](https://discuss.ihp.digitallyinduced.com/t/question-on-creation-with-many-to-many-relationships/77/1 "2024-12-11T00:59:21Z")

</div>

Hello!  
One probably silly question:  
Is it possible to have an Action for a data type that isn’t a model? I have a few models:

- `Exercise`
- `MuscleGroup`
- `ExercisesMuscleGroup` (link table between the two above, it is a many-to-many relationshit).

Ideally, I’d like to submit a form that would create an `Exercise`, and also create the relevant rows in the `ExercisesMuscleGroup` link table.  
I can do this all manually by passing in a custom `param`but I wanted to see if I could leverage the type system to do this kind of work for me.

Does anyone have any tips on how to approach this in a nice manner? I’ve tried a few approaches and it seems like they pull me very much out of my depth.  
You can see the [PR](https://github.com/nunocf/workout_generator/pull/1/files#diff-2e578c8295731d41c72b9d2341bf075e3d5ce20be99f4b8c6a547666c1797393R30-R36) where I’m attempting this here.

I would also like to mention that this has been by far the most fun I’ve had playing around with types!  
I’ve never really had a reason to, but now, I find I am learning a LOT!

Thank you for the great work,  
Nuno

---

<div class="post-metadata">

### Author: ![marc](https://discuss.ihp.digitallyinduced.com/user_avatar/discuss.ihp.digitallyinduced.com/marc/32/9_2.png) [@marc](https://discuss.ihp.digitallyinduced.com/u/marc)
#### Post date: [December 11, 2024, 10:01am UTC](https://discuss.ihp.digitallyinduced.com/t/question-on-creation-with-many-to-many-relationships/77/2 "2024-12-11T10:01:34Z")

</div>

Hey!

Thanks for the feedback 🙂

There’s no great type safe way to do this in IHP, so going with param is already pretty good.

There is some examples in this repo as well: [https://github.com/digitallyinduced/ihp-multi-records-form-example](https://github.com/digitallyinduced/ihp-multi-records-form-example)

---

<div class="post-metadata">

### Author: ![nunocf](https://discuss.ihp.digitallyinduced.com/user_avatar/discuss.ihp.digitallyinduced.com/nunocf/32/43_2.png) [@nunocf](https://discuss.ihp.digitallyinduced.com/u/nunocf)
#### Post date: [December 11, 2024, 1:30pm UTC](https://discuss.ihp.digitallyinduced.com/t/question-on-creation-with-many-to-many-relationships/77/3 "2024-12-11T13:30:30Z")

</div>

Oh, thank you! That was the initial idea I had, but I’m glad to see a fully fleshed out example so I can see what I missed.

Thanks again, this has been so much fun!
