I''m trying to figure out what is the ''rails'' way of doing this. I''m expressing products and their variations. Variations are just products that belong to a parent product. It''s basically a tree structure. Variations can also belong to other variations. What I''m trying to decide is the best way to get all the descendents for a product in one query and keep the table as normalized as possible. The un-normalized way would be to add a root_id column, or I could use a join table I guess. Any thoughts? Chris --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Check out acts_as_nested_set, haven''t used it myself, but apparently it''s really nice for this sort of stuff, allowing you to get everything in one query. /Jonas On 27 Juli, 12:19, snacktime <snackt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to figure out what is the ''rails'' way of doing this. I''m > expressing products and their variations. Variations are just > products that belong to a parent product. It''s basically a tree > structure. Variations can also belong to other variations. What I''m > trying to decide is the best way to get all the descendents for a > product in one query and keep the table as normalized as possible. > The un-normalized way would be to add a root_id column, or I could use > a join table I guess. Any thoughts? > > Chris--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 7/26/07, JN_Coward <jonas.nicklas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Check out acts_as_nested_set, haven''t used it myself, but apparently > it''s really nice for this sort of stuff, allowing you to get > everything in one query.I saw that. I was a little concerned about the added complexity of removing or moving sets to different locations in the tree. I should play with it a little though to see how well it works in practice. Chris --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---