In my form there are fields for various tables.
There is a main table/model. So the additional tables relate to the
main
one. Better I show an example:
User model: Color model:
id = 1 id = 1 | user_id = 1 | color = blue
id = 3 | user_id = 1 | color = red
id = 10 | user_id = 1 color = green
So in other words when the user fills in the form, because they may
select
multiple colors, new rows are created in the Color model, but all must
have the corresponding user_id.
I understand the table relationships, but wonder how the create happens.
Do
I need to use “transactions” or just a regular create? I think I can
stuff
all the colors into a hash ?
Anyway, any suggestions would be greatly appreciated.