simple_nested_set 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_nested_set/move/protection.rb +8 -7
- data/lib/simple_nested_set/version.rb +1 -1
- metadata +136 -162
@@ -17,6 +17,7 @@ module SimpleNestedSet
|
|
17
17
|
def protect_inconsistent_move!
|
18
18
|
left = nested_set.find(left_id) if left_id
|
19
19
|
right = nested_set.find(right_id) if right_id
|
20
|
+
p_id = ( parent_id.to_s =~ /^\d+/ && parent_id.to_s.to_i )
|
20
21
|
|
21
22
|
if left && right && (!left.right_sibling || left.right_sibling.id != right_id)
|
22
23
|
inconsistent_move! <<-msg
|
@@ -26,17 +27,17 @@ module SimpleNestedSet
|
|
26
27
|
msg
|
27
28
|
end
|
28
29
|
|
29
|
-
if left &&
|
30
|
+
if left && p_id && left.parent_id != p_id
|
30
31
|
inconsistent_move! <<-msg
|
31
|
-
Both :left_id (#{left_id.inspect}) and :parent_id (#{
|
32
|
-
left.parent_id (#{left.parent_id}) does not equal parent_id
|
32
|
+
Both :left_id (#{left_id.inspect}) and :parent_id (#{p_id.inspect}) were given but
|
33
|
+
left.parent_id (#{left.parent_id.inspect}) does not equal parent_id
|
33
34
|
msg
|
34
35
|
end
|
35
36
|
|
36
|
-
if right &&
|
37
|
+
if right && p_id && right.parent_id != p_id
|
37
38
|
inconsistent_move! <<-msg
|
38
|
-
Both :right_id (#{right_id.inspect}) and :parent_id (#{
|
39
|
-
right.parent_id (#{right.parent_id}) does not equal parent_id
|
39
|
+
Both :right_id (#{right_id.inspect}) and :parent_id (#{p_id.inspect}) were given but
|
40
|
+
right.parent_id (#{right.parent_id.inspect}) does not equal parent_id
|
40
41
|
msg
|
41
42
|
end
|
42
43
|
end
|
@@ -50,4 +51,4 @@ module SimpleNestedSet
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
53
|
-
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,213 +1,187 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_nested_set
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 8
|
10
|
-
version: 0.1.8
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sven Fuchs
|
14
9
|
- Matthias Viehweger
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-06-14 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: activerecord
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
19
|
+
requirements:
|
27
20
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 1
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
- 3
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 3.0.3
|
35
23
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: gem_patching
|
39
24
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.0.3
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: gem_patching
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
49
39
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: test_declarative
|
53
40
|
prerelease: false
|
54
|
-
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: test_declarative
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
63
55
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: ruby-debug
|
67
56
|
prerelease: false
|
68
|
-
|
69
|
-
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
- 0
|
76
|
-
version: "0"
|
77
|
-
type: :development
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
80
64
|
name: rake
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
hash: 3
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
91
71
|
type: :development
|
92
|
-
version_requirements: *id005
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: sqlite3-ruby
|
95
72
|
prerelease: false
|
96
|
-
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: sqlite3
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
105
87
|
type: :development
|
106
|
-
version_requirements: *id006
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
name: pg
|
109
88
|
prerelease: false
|
110
|
-
|
111
|
-
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: pg
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
121
103
|
type: :development
|
122
|
-
version_requirements: *id007
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
name: mysql2
|
125
104
|
prerelease: false
|
126
|
-
|
127
|
-
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mysql2
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
137
119
|
type: :development
|
138
|
-
version_requirements: *id008
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: database_cleaner
|
141
120
|
prerelease: false
|
142
|
-
|
143
|
-
none: false
|
144
|
-
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: database_cleaner
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - '='
|
133
|
+
- !ruby/object:Gem::Version
|
152
134
|
version: 0.6.0
|
153
135
|
type: :development
|
154
|
-
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - '='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.6.0
|
155
143
|
description: simple_nested_set allows to easily handle nested sets in ActiveRecord
|
156
144
|
email: svenfuchs@artweb-design.de
|
157
145
|
executables: []
|
158
|
-
|
159
146
|
extensions: []
|
160
|
-
|
161
147
|
extra_rdoc_files: []
|
162
|
-
|
163
|
-
|
164
|
-
- lib/simple_nested_set/
|
165
|
-
- lib/simple_nested_set/class_methods.rb
|
166
|
-
- lib/simple_nested_set/inspect.rb
|
167
|
-
- lib/simple_nested_set/instance_methods.rb
|
148
|
+
files:
|
149
|
+
- lib/simple_nested_set.rb
|
150
|
+
- lib/simple_nested_set/nested_set.rb
|
168
151
|
- lib/simple_nested_set/move/by_attributes.rb
|
169
152
|
- lib/simple_nested_set/move/protection.rb
|
170
153
|
- lib/simple_nested_set/move/to_target.rb
|
171
|
-
- lib/simple_nested_set/
|
172
|
-
- lib/simple_nested_set/patches/arel_table_initialization.rb
|
173
|
-
- lib/simple_nested_set/rebuild/from_parents.rb
|
174
|
-
- lib/simple_nested_set/rebuild/from_paths.rb
|
154
|
+
- lib/simple_nested_set/inspect.rb
|
175
155
|
- lib/simple_nested_set/sql_abstraction.rb
|
156
|
+
- lib/simple_nested_set/class_methods.rb
|
157
|
+
- lib/simple_nested_set/instance_methods.rb
|
176
158
|
- lib/simple_nested_set/version.rb
|
177
|
-
- lib/simple_nested_set.rb
|
159
|
+
- lib/simple_nested_set/rebuild/from_parents.rb
|
160
|
+
- lib/simple_nested_set/rebuild/from_paths.rb
|
161
|
+
- lib/simple_nested_set/act_macro.rb
|
162
|
+
- lib/simple_nested_set/patches/arel_table_initialization.rb
|
178
163
|
homepage: http://github.com/svenfuchs/simple_nested_set
|
179
164
|
licenses: []
|
180
|
-
|
181
165
|
post_install_message:
|
182
166
|
rdoc_options: []
|
183
|
-
|
184
|
-
require_paths:
|
167
|
+
require_paths:
|
185
168
|
- lib
|
186
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
170
|
none: false
|
188
|
-
requirements:
|
189
|
-
- -
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
|
192
|
-
|
193
|
-
- 0
|
194
|
-
version: "0"
|
195
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
176
|
none: false
|
197
|
-
requirements:
|
198
|
-
- -
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
|
201
|
-
segments:
|
202
|
-
- 0
|
203
|
-
version: "0"
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
204
181
|
requirements: []
|
205
|
-
|
206
|
-
|
207
|
-
rubygems_version: 1.7.2
|
182
|
+
rubyforge_project: ! '[none]'
|
183
|
+
rubygems_version: 1.8.24
|
208
184
|
signing_key:
|
209
185
|
specification_version: 3
|
210
186
|
summary: a simple to use nested set solution for ActiveRecord 3
|
211
187
|
test_files: []
|
212
|
-
|
213
|
-
has_rdoc:
|