acts-as-tree-with-dotted-ids 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +9 -9
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ccfbe031c422ef8dacaa2a7e3ad1fb49b77257
|
4
|
+
data.tar.gz: eedfcb4254147fb4049bf038d78d248e7368d4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6475476d459b7a69df7ca1fef351f9a1ed25965ce01cc4ed56a357c95dabd84f6936fcc8e98c9d8edffddf7617fe9cd13e2a1bd60b5e9db4282ef651d4718d
|
7
|
+
data.tar.gz: df842c79276203521ce3a4b085fadfb7fdc28ac715a57b18601b478cf6ab8491a6e2f5e7f6e547047d9854e5ff12880ba7472aced0154b63a2dc6e8a37dbd8bf
|
data/README.rdoc
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
= acts_as_tree_with_dotted_ids
|
2
2
|
|
3
|
-
This is an extension to Rails good old acts_as_tree which uses an extra "dotted_ids" column
|
3
|
+
This is an extension to Rails good old acts_as_tree which uses an extra "dotted_ids" column
|
4
4
|
which stores the path of the node as a string of record IDs joined by dots, hence the name.
|
5
5
|
|
6
|
-
This optimization solves performance issues related to in-database tree structure by allowing
|
6
|
+
This optimization solves performance issues related to in-database tree structure by allowing
|
7
7
|
for direct O(1) ancestor/child verification and O(N) subtree access with one single query.
|
8
8
|
|
9
9
|
class Category < ActiveRecord::Base
|
10
10
|
acts_as_tree_with_dotted_ids :order => "name"
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
Example:
|
14
14
|
|
15
15
|
root
|
@@ -18,25 +18,25 @@ Example:
|
|
18
18
|
\_ subchild2
|
19
19
|
|
20
20
|
Usage:
|
21
|
-
|
21
|
+
|
22
22
|
root = Category.create("name" => "root")
|
23
23
|
child1 = root.children.create("name" => "child1")
|
24
24
|
subchild1 = child1.children.create("name" => "subchild1")
|
25
|
-
|
25
|
+
|
26
26
|
root.parent # => nil
|
27
27
|
child1.parent # => root
|
28
28
|
root.children # => [child1]
|
29
29
|
root.children.first.children.first # => subchild1
|
30
30
|
child1.ancestors_of?(subchild2) # => true
|
31
31
|
subchild1.descendant_of?(root) # => true
|
32
|
-
|
32
|
+
|
33
33
|
root.id # 1
|
34
34
|
child1.id # 2
|
35
35
|
subchild1.id # 3
|
36
36
|
root.dotted_ids # "1"
|
37
37
|
child1.dotted_ids # "1.2"
|
38
38
|
subchild1.dotted_ids # "1.2.3"
|
39
|
-
|
39
|
+
|
40
40
|
== Improvements
|
41
41
|
|
42
42
|
The plugin adds the following instance methods:
|
@@ -65,7 +65,7 @@ If you already have an +acts_as_tree+ model, you can easily upgrade it to take a
|
|
65
65
|
|
66
66
|
== Compatibility
|
67
67
|
|
68
|
-
|
68
|
+
From version 1.2.0, this gem is only compatible with Rails 4.x and up.
|
69
69
|
|
70
70
|
|
71
71
|
== Thanks
|
@@ -75,4 +75,4 @@ Kudos to all the contributors to the original plugin.
|
|
75
75
|
|
76
76
|
Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
|
77
77
|
|
78
|
-
Copyright (c) 2008 Xavier Defrang, released under the MIT license
|
78
|
+
Copyright (c) 2008 Xavier Defrang, released under the MIT license
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-tree-with-dotted-ids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -45,20 +45,20 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 4.0.0
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '
|
51
|
+
version: '4.0'
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: 4.0.0
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '4.0'
|
62
62
|
description: ''
|
63
63
|
email: tma@freshbit.ch
|
64
64
|
executables: []
|