I have this Task model:
class Task < ActiveRecord::Base
acts_as_tree :order => 'sort_order'
end
And I have this test
class TaskTest < Test::Unit::TestCase
def setup
@root = create_root
end
def test_destroying_a_task_should_destroy_all_of_its_descendants
d1 = create_task(:parent_id => @root.id, :sort_order => 2)
d...
I'm wondering if someone has already built a system for threaded comments (for lack of a better term) in Rails or if I need to build it myself.
In case it's not clear, what I'm referring to is a comment system like Reddit's that automatically indents replies so that they appear like branches of a tree (preferably with voting just as Re...
I have a model which uses acts-as-tree. For example:
class CartoonCharacter < ActiveRecord::Base
acts_as_tree
end
Acts as tree has these associations:
class ActsAsTree
belongs_to :parent
has_many :children
end
From script/console I am building my tree, saving nothing until the entire tree is constructed. The trouble I am ha...
Using acts_as_tree I would like to be able to preload an entire tree having its complete child hierarchy intact with one SQL call. To that end, I added a tree_id to the table and it runs through all descendants in that tree.
I had explored acts_as_nested_set (actually awesome_nested_set) as a possibility but since I graft trees into ot...
Hi, I have a relatively simple one-to-many relationship and use acts_as_tree to get it organized in the view. It kinda looks like this:
Root
|_Product 1
|_Product 2
|_Category 1.1
|_Product 3
|_Product 4
|_Category 1.1.1
|_Product 5
The way I set it up is that I list products in the 'sh...
I have a Folder model which acts_as_tree.
Is it possible that the routes represent the folder structure?
Folders:
1: Folder A
2: Folder B
3: Folder C
4: Folder D
5: Folder E
Routes:
/folders/1
/folders/1/2
/folders/1/3/4
/folders/1/2/new
/folders/...
Is this possible?
...
I've got several models that I'd like to relate together hierarchically. For simplicity's sake, let's say I've got these three:
class Group < ActiveRecord::Base
acts_as_tree
has_many :users
end
class User < ActiveRecord::Base
acts_as_tree
belongs_to :group
has_many :posts
end
class Post < ActiveRecord::Base
acts_as_tree
...
Now with Formtastic I have plain select:
= f.input :category, :as => :select, :include_blank => false, :collection => subcategories
Here I show only children categories. I use acts_as_tree plugin for parent-child relationship. I would like to show parent categories as well.
Formtastic generated select should look like this one:
<sel...
I have an ActiveRecord class that uses acts_as_tree. I'm trying to update the to_xml method so that if a child record's to_xml is called it will return it's xml nested in the parent/ancestor xml to give the fully-qualified path to that resource. As an example I have Compiler which is a parent of Compiler/Version. Compiler should be re...
I have two simple models each with acts_as_tree, say Departments and Employees.
My goal is to create a treeview combining both models in to one overall tree, like so:
Department 1
SubDepartment 1.1
Employee A
Employee B
SubDepartment 1.2
Department 2
Subdepartment 2.1
Employee C
Department 3
SubDepartment 3.1
Employee D
E...
Hello again,
This time I have problem with access control tables. I have 2 tables like these:
Menu Table
-------------------------------------------------------------------------
| id | parent | caption | link |
-------------------------------------------------------------------------
| mc_tra...