Hello all, I''ve got an object called store_section in which I have called the acts_as_tree function. In several of the views in my site, I have objects which need to specify the store_section that they are in. What I would like is a way to allow the user to select the items out of a drop down list that shows them in the proper hierarchy with indentation to make it easier to select the right item. Is there a quick-and-dirty prebuilt Ruby solution to this, or do I need to create my own? Thanks, Will --------------------------------- The fish are biting. Get more visitors on your site using Yahoo! Search Marketing. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
you could probably create this on your own, but you should look into changing the acts_as_tree you''ve got there to an acts_as_nested_set ; you''ll be saving a lot of queries to the db this way, if you want to display a whole tree.. in one query, you can get a whole tree, branch, etc, without recursive calls to the db. my recommendation anyways. maybe worth looking into. Will Gant wrote:> Hello all, > I''ve got an object called store_section in which I have called the > acts_as_tree function. In several of the views in my site, I have > objects which need to specify the store_section that they are in. What I > would like is a way to allow the user to select the items out of a drop > down list that shows them in the proper hierarchy with indentation to > make it easier to select the right item. Is there a quick-and-dirty > prebuilt Ruby solution to this, or do I need to create my own? > > Thanks, > Will > > > --------------------------------- > The fish are biting. > Get more visitors on your site using Yahoo! Search Marketing.-- 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-/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 -~----------~----~----~----~------~----~------~--~---
Not to counteract what shai said, but it''s not 100% necessary to use acts_as_nested_set if, before rendering anything, you grab the entire tree somehow. If all the objects of the tree share something specific in common, such as root_id, then nested set might not be necessary. I''ve always been wary of nested set; it saves queries in some places but creates more elsewhere; IMO maintenance of a nested set is actually a nightmare behind the scenes. If you decide to use nested set, I would suggest better_nested_set. http://agilewebdevelopment.com/plugins/betternestedset -- 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-/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 -~----------~----~----~----~------~----~------~--~---
> If you decide to use nested set, I would suggest better_nested_set. > > http://agilewebdevelopment.com/plugins/betternestedsetI completely agree -- betternestedset is fantastic. You will need to add some columns to your table though (to indicate left and right position). However it has the hierarchy drop down function you want. -- 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-/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 -~----------~----~----~----~------~----~------~--~---