search for: nestedset

Displaying 7 results from an estimated 7 matches for "nestedset".

Did you mean: nested_set
2006 Apr 11
2
Finding items from two models - then merging them
I have a model, listings. Listings habtm categories and subcategories, which are seperate models. What I want to do is search categories for certain items, like so: @categories = Category.find(:all, :conditions => ["name LIKE ?", "#%{:search_string}%" and subcategories for the same: @subcategories = Subcategory.find(:all, :conditions => ["name LIKE ?",
2006 May 31
1
Help enhancing acts_as_nested_set
...t(options = {}) configuration = { :parent_column => "parent_id", :left_column => "lft", :right_column => "rgt"} configuration.update(options) if options.is_a?(Hash) class_eval <<-EOV include ActiveRecord::Acts::NestedSet::InstanceMethods def self.left_col_name() "#{configuration[:left_column]}" end def left_col_name() "#{configuration[:left_column]}" end def self.right_col_name() "#{configuration[:right_column]}" end def right_col_name()...
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
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
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
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 May 02
4
Bug in rails ?
Hi ! I just have a simple question. I am writing an app using rails to familiarize myself with the framework (which is pretty cool, by the way). I just wanted to know why these two work differently (since "find" should be a synonym for "detect" according to the Pick Axe) : current_item = @invoice.line_items.detect {|i| i.product.id == key} current_item =