similar to: acts_as_tree with Modified Preorder Traversal?

Displaying 20 results from an estimated 500 matches similar to: "acts_as_tree with Modified Preorder Traversal?"

2007 May 02
3
acts_as_tree related question
hi, I''ve a normal Category model implemented with acts_as_tree (name, parent_id) that has_many :products (name, category_id). What I''m asking for is a method to fetch every product that belongs fall into a particular category and its children, eg: if I''m asking for a root node (/category/show/1) I need to display every product that have category_id = 1 AND every product
2009 Aug 19
10
acts_as_list / acts_as_tree / acts_as_nested_set - which one
I am creating forum application which needs usage of acts_as_list or acts_as_tree or acts_as_nested_set. I am unable to decide among these. please could some one recommend from their experience? -- Posted via http://www.ruby-forum.com/.
2005 May 17
8
acts_as_tree elegant tree printing
Hi, I''m working with acts_as_tree to print an unordered list of items: Root -- Child ---- Child I''ve got this working, however I''d like to know if there is a more elegant fashion that I''m unaware of: #Takes a parent category and recursivley returns all children def find_all_subcategories(category) if category.children.size > 0
2009 Feb 17
8
Converting Acts_As_Tree to Acts_As_Nested_Set
Hello, I have a tree structure that needs to be converted into a nested set. A great deal of work has already been done on the tree items, so maintaining the integrity of the id''s is mandatory. However I need the ability to access entire branches of the tree, which is what Nested set does. Does anyone have any suggestions on how to efficiently transfer the tree to the nested set and
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
I am working on an Rails application that uses a pretty complex category structure through out the site. I have defined a table to house all the info and a FK to reference parents within the table CREATE TABLE categories ( id int(11) NOT NULL auto_increment, name varchar(50) NOT NULL, parent_id int(11) default NULL, constraint fk_category_id foreign key (category_id) references
2006 Jun 20
2
Converting from acts_as_tree to acts_as_nested_set
I''m currently using acts_as_tree to display threaded Comments on my forums-like site. It''s waaay too slow to display a page with 1,000 comments, as it''s issuing a TON of selects. I''m pretty sure I want to convert to the nested set model, using acts_as_nested_set or acts_as_threaded. This should give me the performance I''m looking for. The problem,
2005 Oct 19
3
Finding all parents of acts_as_tree relationship
I''m using acts_as_tree to maintain a hierarchy of categories (each top-level category can contain multiple categories and each sub-category can contain multiple sub-categories, etc.). I want to be able to find all parents of a particular category. I realize that I can use @category.parent or even @category.parent.parent to move up in the hierarchy, but I need this to happen dynamically
2009 Apr 13
2
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
That looks like it does a preorder depth first traversal (I think). I'm looking for postorder. Is there a trivial transform between the two? (I don't know one.) Am I wrong about the preorder/postorder? If not, anything lurking for postorder traversal? Thanks, Dan On Apr 13, 2009, at 2:35 PM, Chris Lattner wrote: > > On Apr 13, 2009, at 11:20 AM, Daniel M Gessel wrote:
2008 Apr 08
1
error using method ls.ranking.capa.ident
I'm trying to run the generalized least square approach for my 2-additive problem, unfortunately this error appeared. I have tried to figure out the error from the mailing list but couldn't find the solution. Any help is highly appreciated. This is my source code: >a1 <- c(76.18, 61.84, 60.4, 69.09) > a2 <- c(51.01, 50.39, 87.62, 52.03) > a3 <- c(80.08, 48.49, 90.86,
2006 Feb 06
2
acts_as_nested_set
Where can I see the API acts_as_nested_set constructs? I''ve read its page in api.rubyonrails.com but I don''t see how to manage the tree from there. -- fxn
2006 Feb 25
3
Enumerating over a Tree by Depth
I have a model using acts_as_tree which is working fine. Being new to Ruby I''m don''t know what enumerator is best to use for traversing a tree by depth. I can write one, but before I do I wanted to know if there is there an enumerator for traversing trees available that the community recommends? Thank you, Jose -- Posted via http://www.ruby-forum.com/.
2006 May 10
2
Ordering of subsets in a model.
Alright, I got this table with lots of entries for menus. There''s several menus (with their own model since each menu got some special information). Now, I want to be able to specify the order of the menu entries inside the menu. acts_as_list seems to not quite do the trick since it does ordering "globally" on the whole model and acts_as_nested_set seems like overkill since
2005 Oct 12
2
Help with act_as_nested_set
Hi, I''m trying to get act_as_nested_set working, and I''m puzzled. I googled the following http://codefetch.com/cache?url=http://media.pragprog.com/titles/rails/code/r ails-code.tgz <http://codefetch.com/cache?url=http://media.pragprog.com/titles/rails/code/ rails-code.tgz&path=rails-code/ar/acts_as_nested_set.rb&lang=ruby&qy=ruby>
2009 Apr 13
0
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
po_iterator (ADT/PostOrderIterator.h) ? On Mon, Apr 13, 2009 at 5:40 PM, Daniel M Gessel <gessel at apple.com> wrote: > That looks like it does a preorder depth first traversal (I think). > I'm looking for postorder. Is there a trivial transform between the > two? (I don't know one.) > > Am I wrong about the preorder/postorder? If not, anything lurking for >
2009 Apr 14
1
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
Too obvious! Thanks Dan On Apr 13, 2009, at 7:58 PM, John Mosby wrote: > po_iterator (ADT/PostOrderIterator.h) ? > > On Mon, Apr 13, 2009 at 5:40 PM, Daniel M Gessel <gessel at apple.com> > wrote: > That looks like it does a preorder depth first traversal (I think). > I'm looking for postorder. Is there a trivial transform between the > two? (I don't know
2007 Jul 18
10
Rails - Mock going out of scope?
Hello list, I think I have a rails related RSpec problem with a mock going out of scope on a recursive call to a model. The code is at: http://pastie.textmate.org/79821 if you want to see it highlighted. I have pasted it below as well. Basically, I have an acts_as_nested_set model called "Node", which works fine. I have a function which finds the language name of the node instance.
2006 May 10
1
acts_as_nested_set does not work (in my case).
Hello, I am using acts_as_nested_set. My problem is that the columns "lft" and "rgt" get the value 0 if I create a new entity. If I delete an entity I get negative values (-1, -2, -3) - but for all entities. Is there anything missing? Is there any example for "acts_as_nested_set" in the web? -- Posted via http://www.ruby-forum.com/.
2006 Feb 07
2
Is acts as nested set safe in a concurrent environment?
Hi I was wondering if acts_as_nested_set can be used safely with concurrently updates? The fact that so much of the tree needs to be rewritten on inserts concerns me. Is anyone actually using it. I noticed that the status of acts_as_nested_set was unclear at the time the rails book was written. Regards, Glen
2009 Jun 21
1
cannot do mass_assignment when inherited class ?
I got the following error when trying to create the elibrary instance (rdb:21) @elibrary = Elibrary.new(params[:elibrary]) RuntimeError Exception: Declare either attr_protected or attr_accessible for Elibrary, but not both. params : "elibrary"=>{"title"=>"bingo three", "short_description"=>"something new",
2006 May 12
2
Has many through join table issues
I''m trying to wrap my caffeine soaked brain around has_many :through following along at: http://rails.techno-weenie.net/tip/2005/12/23/teaching_your_blog_model_new_tricks_with_has_many_through I think my models are a little more complex than what fits this narrative. I have a directory of members, each member can belong to multiple categories. The category table references itself