jcnetdev-acts_as_tree 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README +26 -0
  2. data/init.rb +1 -0
  3. data/rails/init.rb +1 -0
  4. metadata +67 -0
data/README ADDED
@@ -0,0 +1,26 @@
1
+ acts_as_tree
2
+ ============
3
+
4
+ Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children
5
+ association. This requires that you have a foreign key column, which by default is called +parent_id+.
6
+
7
+ class Category < ActiveRecord::Base
8
+ acts_as_tree :order => "name"
9
+ end
10
+
11
+ Example:
12
+ root
13
+ \_ child1
14
+ \_ subchild1
15
+ \_ subchild2
16
+
17
+ root = Category.create("name" => "root")
18
+ child1 = root.children.create("name" => "child1")
19
+ subchild1 = child1.children.create("name" => "subchild1")
20
+
21
+ root.parent # => nil
22
+ child1.parent # => root
23
+ root.children # => [child1]
24
+ root.children.first.children.first # => subchild1
25
+
26
+ Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + "/rails/init"
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jcnetdev-acts_as_tree
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - RailsJedi
8
+ - David Heinemeier Hansson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-09-27 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rails
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "2.1"
24
+ version:
25
+ description: ""
26
+ email: railsjedi@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ files:
34
+ - README
35
+ - acts_as_list.gemspec
36
+ - init.rb
37
+ - lib/acts_as_list.rb
38
+ - rails/init.rb
39
+ has_rdoc: true
40
+ homepage: http://github.com/jcnetdev/acts_as_tree
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --main
44
+ - README
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.2.0
63
+ signing_key:
64
+ specification_version: 2
65
+ summary: Allows ActiveRecord Models to be easily structured as a tree
66
+ test_files:
67
+ - test/list_test.rb