Allows you to nest ActiveRecord records with various strategies like tree, set, path, etc.
What makes it different than other nesting gems/plugins?
It aims to provide a standard interface to all nesting related methods no matter what strategy you decide to use. Some strategies are better for read-heavy applications and others are better for write-heavy ones - but you always want the same information - ancestors, children, descendants, siblings, etc. Your application code shouldn't have to change just because you realized that you're better off storing records as a set instead of a tree.
ActiveRecord >= 3.0.0
gem install nestable
Simply call nestable in your model and pass the :strategy that you want to use along with any options related to it (see Strategies below).
class Comment < ActiveRecord::Base nestable :strategy => :path, :scope => :post_id end
Take a look at the documentation at rdoc.info/github/shuber/nestable/master/frames for more information about each strategy.
:tree (Nestable::Strategy::Tree) default
Note on Patches/Pull Requests
Fork the project.
Make your feature addition or bug fix.
Add tests for it. This is important so I don't break it in a future version unintentionally.
Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
Send me a pull request. Bonus points for topic branches.