https://github.com/shuber/nestable
Allows you to nest ActiveRecord records with various strategies like tree, set, path, etc.
https://github.com/shuber/nestable
Last synced: 17 days ago
JSON representation
Allows you to nest ActiveRecord records with various strategies like tree, set, path, etc.
- Host: GitHub
- URL: https://github.com/shuber/nestable
- Owner: shuber
- License: mit
- Created: 2009-06-14T00:35:21.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2011-02-10T09:07:06.000Z (over 15 years ago)
- Last Synced: 2025-02-25T21:42:21.331Z (over 1 year ago)
- Language: Ruby
- Homepage: http://rdoc.info/projects/shuber/nestable
- Size: 143 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
Awesome Lists containing this project
README
= nestable
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.
== Requirements
ActiveRecord >= 3.0.0
== Installation
gem install nestable
== Usage
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
== Strategies
Take a look at the documentation at http://rdoc.info/github/shuber/nestable/master/frames for more information about each strategy.
* :tree (Nestable::Strategy::Tree) default
* :path (Nestable::Strategy::Path)
== 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.