hi, i have a category and a category_type model, where category is selfreferential with parent_id. now, im not 100% sure whats the best way for later purposes in terms of search etc., but my initial intention was the store the category_types_id only in the root (where parent_id == 0), but like i said, how would i search through all children with a specific type of category_type? i mean i could read them into an array, but thats just wrong. should i store the category_type_id in each category? i hope that was not to unclear... ;-) thx tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Tom wrote:> hi, i have a category and a category_type model, where category is > selfreferential with parent_id. now, im not 100% sure whats the best > way for later purposes in terms of search etc., but my initial > intention was the store the category_types_id only in the root (where > parent_id == 0), but like i said, how would i search through all > children with a specific type of category_type? i mean i could read > them into an array, but thats just wrong. > should i store the category_type_id in each category? > > i hope that was not to unclear... ;-) > > thx tomYou _could_ store it in another table, using has_and_belongs_to_many or has_many :through ... -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thx, i went ahead and just marked the root - will see when i hot the forst roadblock;-) tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Tom wrote:> hi, i have a category and a category_type model, where category is > selfreferential with parent_id. now, im not 100% sure whats the best > way for later purposes in terms of search etc.,awesome_nested_set, of course. :)> but my initial > intention was the store the category_types_id only in the root (where > parent_id == 0), but like i said,No, you didn''t say.> how would i search through all > children with a specific type of category_type? i mean i could read > them into an array, but thats just wrong. > should i store the category_type_id in each category? > > i hope that was not to unclear... ;-)It was. What exactly are you trying to do?> > thx tomBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --0015174c3ff2a3911d047ce6ef41 Content-Type: text/plain; charset=ISO-8859-1 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. --0015174c3ff2a3911d047ce6ef41--
Hi Marnen, the idea was having a selreferential table via parent_id or lft/rgt to haev children etc.. now my point of doubts was whether to make "each"top-level record (aka a category) root r to move it into a different table and mark there the type of that category..eg categories: babysitting yard electrics category_types: service contractor job hope that makes it clearer. tom On Mon, Jan 11, 2010 at 12:33 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Tom Tom wrote: >> hi, i have a category and a category_type model, where category is >> selfreferential with parent_id. now, im not 100% sure whats the best >> way for later purposes in terms of search etc., > > awesome_nested_set, of course. :) > >> but my initial >> intention was the store the category_types_id only in the root (where >> parent_id == 0), but like i said, > > No, you didn''t say. > >> how would i search through all >> children with a specific type of category_type? i mean i could read >> them into an array, but thats just wrong. >> should i store the category_type_id in each category? >> >> i hope that was not to unclear... ;-) > > It was. What exactly are you trying to do? > >> >> thx tom > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.