search for: acts_as_tree

Displaying 20 results from an estimated 169 matches for "acts_as_tree".

2006 Jun 17
2
URL based on acts_as_tree using routes
Hi There! I''d like some feedback before I try to implement some funky rails routes based on an acts_as_tree model. I have a Page model that acts_as_tree. I''d like the URLs to look something like this: http://localhost/about-us/staff/jeff or, another example... http://localhost/what-we-do/products/our-great-cms/features/faqs/ So, as many sub-nodes the user creates, that''s how long t...
2006 Apr 12
2
Why doesn''t acts_as_tree support :scope?
I want to implement a unique category tree per user in my system, and I was hoping to use "acts_as_tree" on my category model. It seems as if acts_as_tree makes the assumption that the entire table the model is off of is one large tree. I actually want each user to have their own category trees all stored in the category table so I need it to scope off of the user_id. acts_as_list support...
2006 Jan 16
2
acts_as_tree with Modified Preorder Traversal?
Has anyone extended Rails''s acts_as_tree to use the Modified Preorder Traversal algorithm? This is a really clever trick for optimizing access to trees stored in databases, as described lucidly in this article: http://www.sitepoint.com/article/hierarchical-data-database/2 It adds two integer fields, a "left counter" and...
2006 Jun 08
2
counter_cache is not looking for children_count with acts_as_tree
Hi there, the acts_as_tree API says that I can set a counter cache and that it will automatically increment the "children_count" column. I did that but when I create a new page it asks for a "pages_count" column instead. Here is the relevant part of page.rb model: class Page < ActiveRecord::Base ac...
2006 May 30
2
acts_as_tree, acts_as_list and is invincible (help!)
So I have the following model class Topic < ActiveRecord::Base belongs_to :topic has_many :topics, :order => :position acts_as_tree :order => :position acts_as_list :scope => :topic_id end that I use for a site''s navigation. Everything (list, create, edit, even the drag&drop sort) works fine, except the destroy function, which the vanilla version def destroy Topic.find(params[:id]).destroy redirec...
2007 Feb 14
3
eager loading parents and children (acts_as_tree)
I am struggling with how to do eager loading of an acts_as_tree model. If the model Stuff acts_as_tree I know I can do this to get children as well: Stuff.find(:all, :include => :children) But what if the model I am including is the one that acts_as_tree? For example, say Picture belongs_to Category. Category acts_as_tree and I want to get all pictures t...
2010 Feb 09
3
acts_as_tree question
Hi, I''m trying to implement a very simple acts_as_tree search in my index html. I am able to show the parents, with no issue, but the children will not show. I have something like this for the parent, which displays fine: <% for group in Group.roots %> <td> <tr> <a href="#" onclick="Effect.BlindDown(''sh...
2006 Feb 08
1
Many-To-Many w/acts_as_tree?
Guys, I''m having a problem getting acts_as_tree working. It seems from the Agile book (p. 255) that acts_as_tree only supports one-to-one record relations, whereas I need many-to-many support. In other words, looking at the picture at the top of page 256 where where only 1 id is linked to 1 parent_id, I need multiple id''s linked t...
2007 Jan 25
1
acts_as_tree with acts_as_list
Hello all, I''m having trouble using acts_as_list with acts_as_tree to order the "children". I''ve found a few old posts on the web that seem to indicate that this once worked. class Whatever < ActiveRecord::Base acts_as_tree :order => :position acts_as_list :scope => :parent_id Although the ''position'' field is bei...
2008 Apr 12
1
acts_as_tree undefined method?
i have acts_as_tree installed as plugin under rails 2.0.2 and also its defined in class TreeItems, but when i put this in my view <ul class="tree_level1" id="cars">Furniture <% TreeItem.root.category.children do |cat_children| %> <li><a class="list_item" href=...
2007 Apr 30
2
acts_as_tree
Hi folks, For my app, I needed to modify acts_as_tree (ActiveRecord::Acts::Tree) such that deleting a node would orphan sub-nodes, rather than deleting them. This is accomplished simply by allowing a :dependent option to the acts_as_tree method so that it can be set to :nullify. For my app, I simply did this by adding a file tree.rb to my lib direct...
2006 Dec 25
2
Active Record acts_as_tree and leaf depth
Using acts_as_tree, is it possible to get information of the depth a tree leaf in relation to the root? Or is available to derive information to save in the way "position" can be derived and saved for acts_as_list. --~--~---------~--~----~------------~-------~--~----~ You received this message because yo...
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/.
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own primary key and generating my own unique id for each record. But, this breaks acts_as_tree. Because my new primary key is not an integer, it breaks the SQL query as follows: StatementInvalid in PagesController#create -------------------------------------------------------------------------------------- Mysql::Error: #42S22Unknown column ''1_3'' in ''where clau...
2006 Nov 04
1
acts_as_tree repeats
Hello Railslist, I want to draw a simple single-table Acts_as_tree model. I''ve read some articles about it and read the API docs, and now I''ve got this running: in controller I have: --- def index @pages = Page.find(:all) end --- in the model for Page I have ofcourse: --- acts_as_tree :order => "position" --- in the helper...
2006 Jan 15
2
acts_as_tree & acts_as_list for a single model?
Hi, If I have a db table categories - id - name - parent_id - position is it alright to have the Category model act_as_tree and for each level act_as_list? class Category < ActiveRecord::Base acts_as_tree :order => :position acts_as_list :scope => :parent_id end Thanks, Peter
2009 Feb 09
1
acts_as_tree
i''m using the command script/plugin install acts_as_tree but i''m still having Plugin not found: ["acts_as_tree"] any helps!!! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group....
2006 Feb 03
2
acts_as_tree counter_cache behavior is different than API docs
Before I file a ticket, I''ll query ya''ll about this: The API docs for acts_as_tree''s counter_cache is to create a database column called "children_count" to hold the counter_cache. I have enabled this option in my model. While writing tests I wrote a test for creating children from the a parent: message = @forum_message["parent"].find child =...
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.paren...
2006 Mar 25
2
acts_as_tree wierdness with children.count and children.size
i am making a category tree and i iterate over the category using my counter_cache however it would show a different number than what was actually being represetned in the tree. Here is an example cat.children = [cat2, cat3] puts cat.children.size 2 puts cat.children_count 2 cat4.parent_id = cat.id cat4.save puts cat.children.size