Skip to content

binhgreat/acts_as_nested_set

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ActsAsNestedSet
==============

This acts_as extension provides Nested Set functionality.  Nested Set is similiar to Tree, but with the added feature that you can select the children and all of their descendents with a single query.  A good use case for this is a threaded post system, where you want to display every reply to a comment without multiple selects.


Example
=======

  class Product < ActiveRecord::Base
    acts_as_nested_set
  end

  # In this branch, I has changed a little, so that, rgt and lft are updated automatically.
  # And, you need set :parent_id first, otherwise, root object will be created
  node = Node.new(:parent_id => 20)
  node.data = ...
  node.save


Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license  

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%