Displaying 20 results from an estimated 70000 matches similar to: "Active Records Tree Cache"
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
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/.
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
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
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 Jul 18
1
Bad values for acts_as_nested_set?
I moved from acts_as_tree to acts_as_nested_set because I need the
all_children method.
I''ve seen an alternative way to add this method to acts_as_tree here:
http://www.chuckvose.com/articles/2006/05/24/recursive-children
But I''d prefer to use the more efficient way of acts_as_nested_set (and
not to have to revert to my old code).
Anyway, here''s my issue: if I
2006 Mar 03
5
Message Board?
I''m interested in working on a message board application that uses ruby on
rails.
I''d like to see something end up similar to vBullieten, but with more of a
37signals type of less-is-more philosophy... mostly meaning less need for
preferences and settings and configurations.
I''ve checked rubyforge, and it looks like there are various forum apps
uploaded there, some
2010 May 12
3
Best Gem For Threaded Comment Storage?
Dear List,
Given that I am developing a rails 2.3.5 site,
When it comes to storing threaded comments in a blog or forum,
Then which plugin/gem should be considered "State of the Art"?
I''m starting with these URLs:
http://github.com/rails/acts_as_tree
http://github.com/rails/acts_as_nested_set
http://github.com/collectiveidea/awesome_nested_set
2011 Feb 18
1
Rails plugins new official maintainers
Hey guys,
This is the final list of the new maintainers of each plugin.
We need two more things to do:
First please the owners of the repos add the rest of the maintainers.
Second I will add a note on each rails/plugin mentioning this repos updates.
So from now on, if someone else is interested in helping/contributing
please send a message to the appropriate repo owner.
verification
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,
2006 May 23
7
self-referencing has_many
Having a devil of a time finding records in a self-referencing has_many
table relationship.
Everything is working find looking at the has_many and the belongs_to
relationship.
But, when I try to find all "orphans", records that are neither a parent
nor a child, I can not find a query that work in ActiveRecord.
This query works in MySQL:
SELECT * FROM templates
LEFT JOIN templates
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
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 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
2012 Sep 11
3
question about how to set up an active record adapter to prefer use of prepared statements...
Hi,
I am writing an active record adapter for our new database and when I run
the tests I see lots of statements that could be run as prepared
statements, but instead of passing me bindings AR passes me a fully
specialized SQL string, not in all cases, but in many. Here is an example:
SELECT addrs.* FROM addrs WHERE addrs.user_id = 153 FETCH FIRST 1 ROWS ONLY
I do have this hook set up:
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
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
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
2007 Dec 09
3
Managing Hierarchical Data
Hello,
I am in the process of trying to date hierarchical data in a MySQL
database and convert it into a treeview view JS scripting. As a beginner
to ROR there are still many unknown things to me, and handling this sort
of data is one of them. My question is this: Is there any built in
functionality for handling hierarchical data (via a MySQL DB) in
Rails/Ruby? If there is can someone please
2006 Jan 05
1
Fixture files for inserting tree like behavior doesn''t work
Hi folks around, hope you could help me with my problem.
I have a porblem while testing my Acts_as_Tree behavior with fixtures.
Because all data in the fixture file will be commited at the end the
entries I want to map my tree like structure to will not be present at
this point. Due to this I get a foreign key constraints fails from the
database. Is there any way to solve this problem?
Here