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 -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 10/20/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > > -- > http://en.wikipedia.org/wiki/Dark_ambientAnyone ? The main thing at this point I''m trying to visualize is getting the multiple entries into the additional table. Stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---