Displaying 20 results from an estimated 1000 matches similar to: "acts_as_tree and traversing parent/child relationships"
2006 Aug 07
9
[OT] Rails is built into OS X 10.5
This coming out of WWDC. Pretty cool to see this kind of thing happen.
-- 
J "Brien" | HybridIndie Productions | http://hybridindie.com |
hybridindie@gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/380ae29c/attachment.html
2006 Jun 16
1
sortable acts_as_tree with heirarchy
I''ve been stumbling on the tut at oriontransfer 
(http://wiki.oriontransfer.co.nz/main/show/SortableTree)
I''ve got it working in a one dimensional list and I''ve got the drag and 
drop working on children, but as can''t get it to save the tree.
Here''s my view:
<h2>Menu Prototype 2</h2>
<%= flash[:notice] %>
<ul
2006 Aug 16
5
Dreamhost FastCGI: incomplete headers (0 bytes) errors
Sorry to trouble the list with another Dreamhost problem, but looking 
through the archives I see nothing that can solve my problem.
I have installed my app as per
http://wiki.dreamhost.com/index.php/Ruby_on_Rails#Quick_Start_Guide_August_2006
with a symbolic link from my_domain.tld in ~/ to 
~/apps/residence/public/
I get the Rails welcome screen. I have uploaded my app directory etc, 
and
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
--------------------------------------------------------------------------------------
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               
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 
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 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,
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 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
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 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
 
2006 Sep 13
1
Eager loading with acts_as_tree
So I have a model that acts_as_tree and I run a method on a collection
of all of these records. This method walks the tree and fetches the
parent/children, etc. This results in many, many duplicate SQL queries
to be executed. Is there a way to eagerly load all of these models?
Something along the lines of:
Model.find(:all, :include => [:children, :parent])
If I execute the above statement, I
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            
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
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
2005 Oct 26
1
acts_as_tree parent id problem
Hi all,
I have a simple Category model which acts_as_tree.
In the form partial, I use a select form helper to display all the 
categories so that the user can choose a parent category.  This works 
fine, but when I submit the form, I get an AssociationTypeMismatch
It seems that the parent id that I pass back into the controller is 
being treated as a String, rather than finding the appropriate
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
I''ve been having problems making threaded comments for the last few
days. Mainly with creating children and displaying the children.
Currently, I have comments shown at the bottom of my articles show view.
The top level comments work, but I do not really know how to implement a
way for users to "reply" to the top level comments and take them to a
form (the comment
2007 Jun 27
3
acts_as_tree and before_save
We all know that acts_as_tree gives us ability to set up data in a
tree-like structure and use methods like ''parent'', ''children'' and so on.
Something I''m completely stuck on. Observe.
class Page < ActiveRecord::Base
  acts_as_tree
  def before_save
    raise self.parent.to_yaml
  end
end
Well, you''d think that it should show
2006 Apr 30
4
acts_as_ordered_tree
I need an ordered (sortable tree) and I just was thinking if somehting 
like this is possible:
class Item< ActiveRecord::Base
 acts_as_tree :order => "position"
 acts_as_list :scope => ''parent_id = #{self.id}''
end
For my understanding mixing of two acts_as should be p?ssible, at least 
in this case, right?
Unfortunatly the :scope is not working, I am not