Displaying 20 results from an estimated 7000 matches similar to: "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,
2005 Dec 15
4
Acts_as_tree and routing
I''ve got an acts_as_tree structure which I want to be able to represent 
in the URL, with one field identified as the url component.  In other 
words, if I''ve got this:
def self.up
	create_table :nodes do |t|
		t.column :parent_id, :integer
		t.column :tag, :string	
	end
end
and
class Node < ActiveRecord::Base
	acts_as_tree
end
and what I want the urls to be is something
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.
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
  acts_as_tree :order => :position, :counter_cache => true
 
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 that are members of a category that
2010 Mar 24
4
grouping and acts_as_tree
hi,
im using acts_as_tree and im not sure on how to group find-result.
x = find.almost_all
<p>
<% for y in @x.ancestors.reverse %>
  <%= link_to h(y.title), page  %> >
<% end %>
</p>
gives me a nice "breadcrum". but how is it possible to group the list lets
say by the 1level or second level?
thx
-- 
You received this message because you are
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(''show_<%=
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 to multiple parent_id''s - for 
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="#"><%=h cat_children.name %></a></
li>
		<%
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 being populated,
it appears
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
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 "right counter", to  
each row. By
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
--------------------------------------------------------------------------------------
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 I have;
---
  def
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 you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
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/.
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.
To post to this group, send email
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
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 Sep 23
6
problem with acts_as_tree
Hi,
  I''m using the latest gem version of rails under MacOS Tiger.
  I was trying to use acts_as_tree as described in the rails book. So  
I have something like:
class Category < ActiveRecord::Base
    acts_as_tree :order => "title"
end
create table categories (
     id                    int                        not null  
auto_increment,
     title