Sha256: 6eb79d6e4d36342563bf1d1ed74dbc6bc6d9d0d7f619beb14dc217394bbf69eb

Contents?: true

Size: 853 Bytes

Versions: 11

Compression:

Stored size: 853 Bytes

Contents

= 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)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dm-is-tree-1.0.2 README.rdoc
dm-is-tree-1.0.1 README.rdoc
dm-is-tree-1.0.0 README.rdoc
dm-is-tree-1.0.0.rc3 README.rdoc
dm-is-tree-1.0.0.rc2 README.rdoc
dm-is-tree-1.0.0.rc1 README.rdoc
dm-is-tree-0.10.2 README.rdoc
dm-is-tree-0.10.1 README.rdoc
dm-is-tree-0.10.0 README.rdoc
dm-is-tree-0.9.11 README.txt
dm-is-tree-0.9.10 README.txt