arboreal 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/arboreal/instance_methods.rb +3 -3
- data/lib/arboreal/version.rb +1 -1
- data/spec/spec_helper.rb +0 -5
- metadata +13 -18
@@ -13,7 +13,7 @@ module Arboreal
|
|
13
13
|
|
14
14
|
# return a scope matching all ancestors of this node
|
15
15
|
def ancestors
|
16
|
-
model_base_class.scoped(:conditions => ancestor_conditions, :order =>
|
16
|
+
model_base_class.scoped(:conditions => ancestor_conditions, :order => :ancestry_string)
|
17
17
|
end
|
18
18
|
|
19
19
|
# return a scope matching all descendants of this node
|
@@ -51,12 +51,12 @@ module Arboreal
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def descendant_conditions
|
54
|
-
["#{table_name}.ancestry_string
|
54
|
+
["#{table_name}.ancestry_string LIKE ?", path_string + "%"]
|
55
55
|
end
|
56
56
|
|
57
57
|
def subtree_conditions
|
58
58
|
[
|
59
|
-
"#{table_name}.id = ? OR #{table_name}.ancestry_string
|
59
|
+
"#{table_name}.id = ? OR #{table_name}.ancestry_string LIKE ?",
|
60
60
|
id, path_string + "%"
|
61
61
|
]
|
62
62
|
end
|
data/lib/arboreal/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -3,11 +3,6 @@ require 'spec'
|
|
3
3
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
4
4
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
5
|
|
6
|
-
require "rubygems"
|
7
|
-
|
8
|
-
ENV["AR_VERSION"] ||= "~> 2.3.5"
|
9
|
-
gem "activerecord", ENV["AR_VERSION"]
|
10
|
-
|
11
6
|
require "active_record"
|
12
7
|
require "logger"
|
13
8
|
require "fileutils"
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arboreal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Mike Williams
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-14 00:00:00 +10:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: activerecord
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 2
|
29
32
|
- 3
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: activesupport
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
41
46
|
segments:
|
42
47
|
- 2
|
43
48
|
- 3
|
@@ -45,20 +50,6 @@ dependencies:
|
|
45
50
|
version: 2.3.0
|
46
51
|
type: :runtime
|
47
52
|
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rspec
|
50
|
-
prerelease: false
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 1
|
57
|
-
- 2
|
58
|
-
- 9
|
59
|
-
version: 1.2.9
|
60
|
-
type: :development
|
61
|
-
version_requirements: *id003
|
62
53
|
description: |
|
63
54
|
Arboreal is yet another extension to ActiveRecord to support tree-shaped data structures.
|
64
55
|
|
@@ -100,25 +91,29 @@ rdoc_options:
|
|
100
91
|
require_paths:
|
101
92
|
- lib
|
102
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
103
95
|
requirements:
|
104
96
|
- - ">="
|
105
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 57
|
106
99
|
segments:
|
107
100
|
- 1
|
108
101
|
- 8
|
109
102
|
- 7
|
110
103
|
version: 1.8.7
|
111
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
112
106
|
requirements:
|
113
107
|
- - ">="
|
114
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
115
110
|
segments:
|
116
111
|
- 0
|
117
112
|
version: "0"
|
118
113
|
requirements: []
|
119
114
|
|
120
115
|
rubyforge_project:
|
121
|
-
rubygems_version: 1.3.
|
116
|
+
rubygems_version: 1.3.7
|
122
117
|
signing_key:
|
123
118
|
specification_version: 3
|
124
119
|
summary: Efficient tree structures for ActiveRecord
|