Question about multi-table creates

Little unsure how to get started on this one.

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.

Stuart

Hi Stuart -

I would just create the color / user records in the controller. I’m not
sure transactions can be used across models. (anyone know better?).

Starr

On 10/20/06, Dark A. [email protected] wrote:

                       id = 10 | user_id = 1 color = green


Dark ambient - Wikipedia

Anyone ? The main thing at this point I’m trying to visualize is getting
the
multiple entries into the additional table.

Stuart