Hello, I am in the process of trying to date hierarchical data in a MySQL database and convert it into a treeview view JS scripting. As a beginner to ROR there are still many unknown things to me, and handling this sort of data is one of them. My question is this: Is there any built in functionality for handling hierarchical data (via a MySQL DB) in Rails/Ruby? If there is can someone please explain it or link to documentation on it? That would be of great help, thanks. - Josh -- 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 -~----------~----~----~----~------~----~------~--~---
On Dec 9, 2007 3:10 PM, Josh Gilman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > I am in the process of trying to date hierarchical data in a MySQL > database and convert it into a treeview view JS scripting. As a beginner > to ROR there are still many unknown things to me, and handling this sort > of data is one of them. My question is this: Is there any built in > functionality for handling hierarchical data (via a MySQL DB) in > Rails/Ruby? If there is can someone please explain it or link to > documentation on it? That would be of great help, thanks. >Models: acts_as_nested_set acts_as_list acts_as_tree http://www.oreillynet.com/ruby/blog/2006/07/treemap_on_rails.html Controllers: http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/ Do any of those help? You could also simply setup your models appropriately and use some type of parent_id as a foreign key. Regards, Michael Guterl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Guterl wrote:> On Dec 9, 2007 3:10 PM, Josh Gilman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> > Models: > acts_as_nested_set > acts_as_list > acts_as_tree > http://www.oreillynet.com/ruby/blog/2006/07/treemap_on_rails.html > > Controllers: > http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/ > > Do any of those help? You could also simply setup your models > appropriately > and use some type of parent_id as a foreign key. > > Regards, > Michael GuterlSomewhat, though not really. Essentially what I am trying to build is a hierarchical subject list, like how you might navigate a site. For instance you select "Toys" and it drops down to list the sub-groups "electronic" and "mobile". I was simply wondering if there were any tools to help organize this data so that creating such a list would be much more simpler as I lack the skills to hard code my own version into the model. -- 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 -~----------~----~----~----~------~----~------~--~---
markus-JwLqD+LtGXNBDgjK7y7TUQ@public.gmane.org
2007-Dec-09 22:42 UTC
Re: Managing Hierarchical Data
You are probably looking for "acts_as_tree" (google for details). --MarkusQ Sent via BlackBerry from T-Mobile --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---