Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 1190 commits ahead of cardmagic:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
lib
spec
tasks
History.txt
LICENSE
Manifest.txt
README.txt
Rakefile
TODO

README.txt

= dm-is-tree

DataMapper plugin allowing the creation of tree structures from data models.

Example:

class Category
  include DataMapper::Resource

  property :id, Serial
  property :parent_id, Integer
  property :name, String

  is :tree, :order => :name
end

root
  +- child
    +- grandchild1
    +- grandchild2

root = Category.create(:name => "root")
child = root.children.create(:name => "child")
grandchild1 = child1.children.create(:name => "grandchild1")
grandchild2 = child2.children.create(:name => "grandchild2")

root.parent  # => nil
child.parent  # => root
root.children  # => [child]
root.children.first.children.first  # => grandchild1
Category.first_root  # => root
Category.roots  # => [root]

Original Author:: Timothy Bennett (http://lanaer.com)
Current Maintainer:: Garrett Heaver (http://www.linkedin.com/pub/dir/garrett/heaver)
Something went wrong with that request. Please try again.