nested-sets

rails awesome nested set show all cats, sub cats, and sub sub cats

Hello, I saw this post http://stackoverflow.com/questions/2059920/ruby-on-rails-awesome-nested-set-plugin but I am wondering how to do the same thing without using node? I am also wondering what exactly this node is doing in the code itself. In my categories view folder i have _category.html.erb and a _full_categores_list.html.erb. ...

How to repair a corrupted MPTT tree (nested set) in the database using SQL?

I have an MPTT tree of over 100,000 records stored in MySQL using lft, rght and parent_id columns. Now the left/right values became corrupted, while the parent ids are still intact. It would require tons of queries to repair it in the application layer. Is there a good way to put the burden on the database and have it recalculate the lef...

How to merge two nested set structures with on mysql query

Hey MySql Pros hope you can get me a hint, I've a problem with my NestedSets Structure. I have two NestedSets Structures, the first Structure(MainNestedSets) holds my nested sets information and a ReferenceCID to another NestedSets Structure(OtherNestedSets) see below. Now I want to receive the Result set seen in ResultAfterQuery, how...

Complex aggregate functions and hierarchical structures in SQL

I want to store a tree structure of arbitrary depth in an SQL database (MySQL, but want to avoid DBMS-specific features). Now I want to compute a value N for each node as follows: first, calculate the sum of a certain column in all (immediate) children of the current node which are leaves (i.e. have no children) then, calculate the max...

Creating a nested set with sqlite and Objective-c

I was struggling with nested sets, specifically building one on the iPhone using sqlite. I found a handy script that I then adapted from PHP. It basically sets the left and right values based on parent ids. So you need a table where each entry has an 'id' and a 'pid' as well as 'lft' and 'rgt'. I find it easy to map the ids to their re...

How to load all children of a better nested set with activerecord?

Hello, I'm using better nested set. I now want a active record statement, where I can get all top elements and include all elements of this root! How is this possible? I think there must be a possibility to include all the childrens into their root elements in one statement... Does anybody have an idea how to do this? Thanks for your...

nested routing in rails

Desired url, a geo example: domain.com/france/ # Would show all things to do in France domain.com/france/ile-de-france/ # Would show all things to do in Ile-de-France domain.com/france/ile-de-france/paris # Would show all things to do in paris This geographical url writing is quite easy of course with rails routing. Problem is that it...