simple_nested_set 0.0.22 → 0.0.23
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.
@@ -129,14 +129,17 @@ module SimpleNestedSet
|
|
129
129
|
# where(where_clauses.map { |clause| clause.gsub(table_name, 'l') })
|
130
130
|
# "level = (#{query.to_sql})"
|
131
131
|
|
132
|
+
scope = where_clauses.map { |clause| clause.gsub(table_name, 'l') }.join(' AND ')
|
133
|
+
scope = "AND #{scope}" unless scope.empty?
|
134
|
+
|
132
135
|
%(
|
133
136
|
level = (
|
134
137
|
SELECT COUNT("l"."id")
|
135
138
|
FROM #{table_name} AS l
|
136
139
|
WHERE
|
137
140
|
l.lft < #{table_name}.lft AND
|
138
|
-
l.rgt > #{table_name}.rgt
|
139
|
-
#{
|
141
|
+
l.rgt > #{table_name}.rgt
|
142
|
+
#{scope}
|
140
143
|
)
|
141
144
|
)
|
142
145
|
end
|
@@ -149,14 +152,17 @@ module SimpleNestedSet
|
|
149
152
|
# where(where_clauses.map { |clause| clause.gsub(table_name, 'l') })
|
150
153
|
# "path = (#{query.to_sql})"
|
151
154
|
|
155
|
+
scope = where_clauses.map { |clause| clause.gsub(table_name, 'l') }.join(' AND ')
|
156
|
+
scope = "AND #{scope}" unless scope.empty?
|
157
|
+
|
152
158
|
%(
|
153
159
|
path = (
|
154
160
|
SELECT #{group_concat(db_adapter, :slug)}
|
155
161
|
FROM #{table_name} AS l
|
156
162
|
WHERE
|
157
163
|
l.lft <= #{table_name}.lft AND
|
158
|
-
l.rgt >= #{table_name}.rgt
|
159
|
-
#{
|
164
|
+
l.rgt >= #{table_name}.rgt
|
165
|
+
#{scope}
|
160
166
|
)
|
161
167
|
)
|
162
168
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_nested_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 23
|
10
|
+
version: 0.0.23
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-21 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|