activerecord-hierarchical_query 1.4.2 → 1.4.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08114c6cb19f90e4d95e49040d5ebad5392b9a06f364b7a9d623e15cef18379d'
|
4
|
+
data.tar.gz: b6c88c4147010c528a4c8d97109710997b1594931aa6f0d9eda29f0cb851b06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19a846408d55495b83515064cb69824c69e18768398349146c7d50a62a5ed958ee21ec099b0d331431d650a9847f0c8156acf53fd9a7e85cdb8f62eb7cf375f
|
7
|
+
data.tar.gz: 75415a7c1fcd97b92c387a06edf9e2e6effc160f82ab6ba017b43128f414a1dc5fd69a583317e6d5ec881b802beb4d2c3588f0f77bef0596efd2a13bffd9672e
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# ActiveRecord::HierarchicalQuery
|
2
2
|
|
3
|
-
[](https://travis-ci.org/take-five/activerecord-hierarchical_query)
|
4
3
|
[](https://codeclimate.com/github/take-five/activerecord-hierarchical_query)
|
5
4
|
[](https://coveralls.io/r/take-five/activerecord-hierarchical_query)
|
6
5
|
[](http://badge.fury.io/rb/activerecord-hierarchical_query)
|
@@ -27,12 +27,10 @@ module ActiveRecord
|
|
27
27
|
order_values.each do |value|
|
28
28
|
Array.wrap(as_orderings(value)).each do |ordering|
|
29
29
|
@values << ordering
|
30
|
-
|
31
|
-
yield ordering
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
@values
|
33
|
+
@values.each(&block)
|
36
34
|
end
|
37
35
|
|
38
36
|
# Returns order expression to be inserted into SELECT clauses of both
|
@@ -120,11 +120,6 @@ describe ActiveRecord::HierarchicalQuery do
|
|
120
120
|
assert_ordered_by_name_desc { order_siblings(name: :desc) }
|
121
121
|
end
|
122
122
|
|
123
|
-
it 'orders rows by String' do
|
124
|
-
assert_ordered_by_name_desc { order_siblings('name desc') }
|
125
|
-
assert_ordered_by_name_asc { order_siblings('name asc') }
|
126
|
-
end
|
127
|
-
|
128
123
|
it 'orders rows by Arel::Nodes::Ordering' do
|
129
124
|
assert_ordered_by_name_desc { order_siblings(table[:name].desc) }
|
130
125
|
end
|
@@ -153,6 +148,26 @@ describe ActiveRecord::HierarchicalQuery do
|
|
153
148
|
expect(relation.to_sql).not_to match /row_number/i
|
154
149
|
end
|
155
150
|
end
|
151
|
+
|
152
|
+
context 'when ordering by String' do
|
153
|
+
it 'orders rows by one column' do
|
154
|
+
assert_ordered_by_name_desc { order_siblings('name desc') }
|
155
|
+
assert_ordered_by_name_asc { order_siblings('name asc') }
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'orders rows by multiple columns' do
|
159
|
+
root.update!(name: "Root", trait_id: "a")
|
160
|
+
child_2.update!(name: 'Same Name', trait_id: 'a')
|
161
|
+
child_3.update!(name: 'Same Name', trait_id: 'b')
|
162
|
+
root2 = klass.create(name: "Root", trait_id: "b")
|
163
|
+
|
164
|
+
expect(
|
165
|
+
klass.join_recursive do |b|
|
166
|
+
b.connect_by(id: :parent_id).start_with(parent_id: nil).order_siblings('name asc, trait_id desc')
|
167
|
+
end
|
168
|
+
).to eq [root2, root, child_1, child_3, child_2, child_4, child_5]
|
169
|
+
end
|
170
|
+
end
|
156
171
|
end
|
157
172
|
|
158
173
|
describe 'LIMIT and OFFSET clauses' do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-hierarchical_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexei Mikhailov
|
8
8
|
- Zach Aysan
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '0.21'
|
41
41
|
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '1.
|
43
|
+
version: '1.6'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: '0.21'
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
53
|
+
version: '1.6'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: bundler
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0.16'
|
124
|
-
description:
|
124
|
+
description:
|
125
125
|
email:
|
126
126
|
- amikhailov83@gmail.com
|
127
127
|
- zachaysan@gmail.com
|
@@ -154,7 +154,7 @@ homepage: https://github.com/take-five/activerecord-hierarchical_query
|
|
154
154
|
licenses:
|
155
155
|
- MIT
|
156
156
|
metadata: {}
|
157
|
-
post_install_message:
|
157
|
+
post_install_message:
|
158
158
|
rdoc_options: []
|
159
159
|
require_paths:
|
160
160
|
- lib
|
@@ -169,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.4.
|
173
|
-
signing_key:
|
172
|
+
rubygems_version: 3.4.1
|
173
|
+
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Recursively traverse trees using a single SQL query
|
176
176
|
test_files:
|