active_sort_order 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +7 -1
- data/lib/active_sort_order/concerns/sort_order_concern.rb +11 -7
- data/lib/active_sort_order/version.rb +1 -1
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +339 -0
- data/test/unit/active_sort_order_test.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '089c16d2abd0a4aeb75c3a377d54f70883a7397758841c55f7bb64940cb3b205'
|
4
|
+
data.tar.gz: caf3be0137352d2c1df913f9bdf6749253d15e7ed852d1bba646a2ce58fe90f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf7872401a767653abe756bc53955e2daa7df56cc1c37a204feff1f409290b0b11ea6cd9afc6e2376992e7be594f6d7c63add7f47e5ebee042fa9092f2dda1a
|
7
|
+
data.tar.gz: aff10d7f87d429fe6e6e3c14a1697d2641eaf7a2cd427475c79d6f803bcbca64a47861d8e0f93de79e26ed8c44fa9267b981cd5e5b83a4cf40ae3dd0c92b47bf
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,7 @@ CHANGELOG
|
|
2
2
|
---------
|
3
3
|
|
4
4
|
- **Unreleased - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.2...master)**
|
5
|
-
*
|
5
|
+
* Allow ability to sort on multiple fields
|
6
6
|
|
7
7
|
- **v0.9.2 - Apr 28, 2021 - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.1...v0.9.2)**
|
8
8
|
* Fix deprecation warning in Rails 6.1 for `reorder(nil)`
|
data/README.md
CHANGED
@@ -36,8 +36,12 @@ In the below examples we are within a controller and are using the params as our
|
|
36
36
|
```ruby
|
37
37
|
# app/controllers/posts_controller.rb
|
38
38
|
|
39
|
-
|
39
|
+
case params[:sort]
|
40
|
+
when "number_str"
|
40
41
|
sort_col_sql = "CAST(posts.number_str AS int)"
|
42
|
+
when "user"
|
43
|
+
### To sort on multiple fields pass in an Array
|
44
|
+
sort_col_sql = ["users.first_name", "users.last_name"]
|
41
45
|
else
|
42
46
|
sort_col_sql = params[:sort]
|
43
47
|
end
|
@@ -49,6 +53,8 @@ Post.all.sort_order(sort_col_sql, params[:direction], base_sort_order: "lower(nu
|
|
49
53
|
Post.all.sort_order(sort_col_sql, params[:direction])
|
50
54
|
```
|
51
55
|
|
56
|
+
## Sorting on multiple columns
|
57
|
+
|
52
58
|
##### Method Definition:
|
53
59
|
|
54
60
|
`sort_order(sort_col_sql = nil, sort_direction_sql = nil, base_sort_order: true)`
|
@@ -5,12 +5,12 @@ module ActiveSortOrder
|
|
5
5
|
included do
|
6
6
|
|
7
7
|
scope :sort_order, ->(sort_col_sql = nil, sort_direction_sql = nil, base_sort_order: true){
|
8
|
-
if [String, Symbol, NilClass].exclude?(sort_col_sql.class)
|
9
|
-
raise ArgumentError.new("Invalid first argument `sort_col_sql`, expecting a a String or Symbol")
|
10
|
-
end
|
11
|
-
|
12
8
|
if sort_col_sql.present?
|
13
|
-
|
9
|
+
if sort_col_sql.is_a?(Array)
|
10
|
+
sort_col_sql = sort_col_sql.map{|x| x.to_s }
|
11
|
+
else
|
12
|
+
sort_col_sql = sort_col_sql.to_s
|
13
|
+
end
|
14
14
|
|
15
15
|
### SORT DIRECTION HANDLING
|
16
16
|
if sort_direction_sql.is_a?(Symbol)
|
@@ -20,7 +20,7 @@ module ActiveSortOrder
|
|
20
20
|
if sort_direction_sql.nil? || (sort_direction_sql.is_a?(String) && sort_direction_sql == "")
|
21
21
|
sort_direction_sql = "ASC"
|
22
22
|
elsif !sort_direction_sql.is_a?(String)
|
23
|
-
raise ArgumentError.new("Invalid second argument `sort_direction_sql`, expecting a
|
23
|
+
raise ArgumentError.new("Invalid second argument `sort_direction_sql`, expecting a String or Symbol")
|
24
24
|
else
|
25
25
|
valid_directions = [
|
26
26
|
"ASC",
|
@@ -41,7 +41,11 @@ module ActiveSortOrder
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
if !sort_col_sql.is_a?(Array)
|
45
|
+
sort_col_sql = [sort_col_sql]
|
46
|
+
end
|
47
|
+
|
48
|
+
sql_str = sort_col_sql.map{|x| "#{x} #{sort_direction_sql}" }.join(", ")
|
45
49
|
end
|
46
50
|
|
47
51
|
### BASE SORT ORDER HANDLING
|
Binary file
|
data/test/dummy_app/log/test.log
CHANGED
@@ -201,3 +201,342 @@ ActiveSortOrderTest: test_argument_base_sort_order_errors
|
|
201
201
|
ActiveSortOrderTest: test_sort_direction_errors
|
202
202
|
-----------------------------------------------
|
203
203
|
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
204
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
205
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
206
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
207
|
+
[1m[35m (0.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
208
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
209
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
210
|
+
[1m[35m (1.6ms)[0m [1m[31mDELETE FROM posts;[0m
|
211
|
+
[1m[35m (1.3ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
212
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
213
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
214
|
+
[1m[36mPost Create (0.3ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
215
|
+
[1m[36mTRANSACTION (0.8ms)[0m [1m[36mcommit transaction[0m
|
216
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
217
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
218
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
219
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
220
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
221
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
222
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
223
|
+
[1m[36mTRANSACTION (0.5ms)[0m [1m[36mcommit transaction[0m
|
224
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
225
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
226
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
227
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
228
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
229
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
230
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
231
|
+
[1m[36mTRANSACTION (1.1ms)[0m [1m[36mcommit transaction[0m
|
232
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[36mbegin transaction[0m
|
233
|
+
-------------------------------------------------------
|
234
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
235
|
+
-------------------------------------------------------
|
236
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
237
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
238
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
239
|
+
-------------------------------------------------
|
240
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
241
|
+
-------------------------------------------------
|
242
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
243
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
244
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
245
|
+
--------------------------------------------------
|
246
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
247
|
+
--------------------------------------------------
|
248
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
249
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
250
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
251
|
+
----------------------------------------------------
|
252
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
253
|
+
----------------------------------------------------
|
254
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
255
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
256
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
257
|
+
---------------------------------------------
|
258
|
+
ActiveSortOrderTest: test_exposes_main_module
|
259
|
+
---------------------------------------------
|
260
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
261
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
262
|
+
-----------------------------------
|
263
|
+
ActiveSortOrderTest: test_sort_only
|
264
|
+
-----------------------------------
|
265
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
266
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
267
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
268
|
+
-----------------------------------------
|
269
|
+
ActiveSortOrderTest: test_exposes_version
|
270
|
+
-----------------------------------------
|
271
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
272
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
273
|
+
-------------------------------------------------------
|
274
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
275
|
+
-------------------------------------------------------
|
276
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
277
|
+
[1m[36mPostWithBaseOrderA Load (0.2ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ ORDER BY "posts"."b" DESC LIMIT ?[0m [["LIMIT", 11]]
|
278
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ ORDER BY "posts"."b" DESC LIMIT ?[0m [["LIMIT", 11]]
|
279
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
280
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
281
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
282
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
283
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
284
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
285
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
286
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" /* loading for inspect */ LIMIT ?[0m [["LIMIT", 11]]
|
287
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
288
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
289
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
290
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
291
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
292
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
293
|
+
[1m[35m (1.8ms)[0m [1m[31mDELETE FROM posts;[0m
|
294
|
+
[1m[35m (1.4ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
295
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
296
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
297
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
298
|
+
[1m[36mTRANSACTION (0.8ms)[0m [1m[36mcommit transaction[0m
|
299
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
300
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
301
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
302
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
303
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
304
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
305
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
306
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
307
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
308
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
309
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
310
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
311
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
312
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
313
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
314
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
315
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
316
|
+
---------------------------------------------
|
317
|
+
ActiveSortOrderTest: test_exposes_main_module
|
318
|
+
---------------------------------------------
|
319
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
320
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
321
|
+
-------------------------------------------------------
|
322
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
323
|
+
-------------------------------------------------------
|
324
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
325
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
326
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
327
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
328
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
329
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
330
|
+
-----------------------------------
|
331
|
+
ActiveSortOrderTest: test_sort_only
|
332
|
+
-----------------------------------
|
333
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
334
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY a desc, posts.a ASC[0m
|
335
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
336
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
337
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
338
|
+
-----------------------------------------
|
339
|
+
ActiveSortOrderTest: test_exposes_version
|
340
|
+
-----------------------------------------
|
341
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
342
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
343
|
+
--------------------------------------------------
|
344
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
345
|
+
--------------------------------------------------
|
346
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
347
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
348
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b DESC, posts.b ASC[0m
|
349
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
350
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
351
|
+
-------------------------------------------------
|
352
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
353
|
+
-------------------------------------------------
|
354
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
355
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
356
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
357
|
+
-------------------------------------------------------
|
358
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
359
|
+
-------------------------------------------------------
|
360
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
361
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
362
|
+
----------------------------------------------------
|
363
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
364
|
+
----------------------------------------------------
|
365
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
366
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC[0m
|
367
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
368
|
+
[1m[36mPostWithBaseOrderAAndB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC, posts.b ASC[0m
|
369
|
+
[1m[36mPostWithBaseOrderBAndA Load (0.8ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC, posts.a ASC[0m
|
370
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
371
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
372
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
373
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
374
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
375
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
376
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
377
|
+
[1m[35m (1.2ms)[0m [1m[31mDELETE FROM posts;[0m
|
378
|
+
[1m[35m (0.9ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
379
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
380
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
381
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
382
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
383
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
384
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
385
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
386
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
387
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
388
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
389
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
390
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
391
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
392
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
393
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
394
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
395
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
396
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
397
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
398
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
399
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
400
|
+
-----------------------------------
|
401
|
+
ActiveSortOrderTest: test_sort_only
|
402
|
+
-----------------------------------
|
403
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
404
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY a desc, posts.a ASC[0m
|
405
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
406
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
407
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
408
|
+
---------------------------------------------
|
409
|
+
ActiveSortOrderTest: test_exposes_main_module
|
410
|
+
---------------------------------------------
|
411
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
412
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
413
|
+
-----------------------------------------
|
414
|
+
ActiveSortOrderTest: test_exposes_version
|
415
|
+
-----------------------------------------
|
416
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
417
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
418
|
+
----------------------------------------------------
|
419
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
420
|
+
----------------------------------------------------
|
421
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
422
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC[0m
|
423
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
424
|
+
[1m[36mPostWithBaseOrderAAndB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC, posts.b ASC[0m
|
425
|
+
[1m[36mPostWithBaseOrderBAndA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC, posts.a ASC[0m
|
426
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
427
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
428
|
+
-------------------------------------------------------
|
429
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
430
|
+
-------------------------------------------------------
|
431
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
432
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
433
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
434
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
435
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
436
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
437
|
+
-------------------------------------------------------
|
438
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
439
|
+
-------------------------------------------------------
|
440
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
441
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
442
|
+
--------------------------------------------------
|
443
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
444
|
+
--------------------------------------------------
|
445
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
446
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
447
|
+
[1m[36mPostWithBaseOrderB Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b DESC, posts.b ASC[0m
|
448
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
449
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
450
|
+
-------------------------------------------------
|
451
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
452
|
+
-------------------------------------------------
|
453
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
454
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b asc, a asc, posts.a ASC[0m
|
455
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b desc, a desc, posts.a ASC[0m
|
456
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
457
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
458
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
459
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
460
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
461
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
462
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
463
|
+
[1m[35m (1.3ms)[0m [1m[31mDELETE FROM posts;[0m
|
464
|
+
[1m[35m (0.7ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
465
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
466
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
467
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
468
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
469
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
470
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
471
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
472
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
473
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
474
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
475
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
476
|
+
[1m[36mTRANSACTION (0.8ms)[0m [1m[36mcommit transaction[0m
|
477
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
478
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
479
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
480
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
481
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
482
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
483
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
484
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
485
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
486
|
+
-------------------------------------------------
|
487
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
488
|
+
-------------------------------------------------
|
489
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
490
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b asc, a asc, posts.a ASC[0m
|
491
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b desc, a desc, posts.a ASC[0m
|
492
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
493
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
494
|
+
----------------------------------------------------
|
495
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
496
|
+
----------------------------------------------------
|
497
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
498
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC[0m
|
499
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
500
|
+
[1m[36mPostWithBaseOrderAAndB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC, posts.b ASC[0m
|
501
|
+
[1m[36mPostWithBaseOrderBAndA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC, posts.a ASC[0m
|
502
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
503
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
504
|
+
--------------------------------------------------
|
505
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
506
|
+
--------------------------------------------------
|
507
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
508
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
509
|
+
[1m[36mPostWithBaseOrderB Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b DESC, posts.b ASC[0m
|
510
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
511
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
512
|
+
-----------------------------------------
|
513
|
+
ActiveSortOrderTest: test_exposes_version
|
514
|
+
-----------------------------------------
|
515
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
516
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
517
|
+
-----------------------------------
|
518
|
+
ActiveSortOrderTest: test_sort_only
|
519
|
+
-----------------------------------
|
520
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
521
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY a desc, posts.a ASC[0m
|
522
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
523
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
524
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
525
|
+
-------------------------------------------------------
|
526
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
527
|
+
-------------------------------------------------------
|
528
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
529
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
530
|
+
-------------------------------------------------------
|
531
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
532
|
+
-------------------------------------------------------
|
533
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
534
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
535
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
536
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
537
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
538
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
539
|
+
---------------------------------------------
|
540
|
+
ActiveSortOrderTest: test_exposes_main_module
|
541
|
+
---------------------------------------------
|
542
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
@@ -121,4 +121,24 @@ class ActiveSortOrderTest < ActiveSupport::TestCase
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
def test_sort_on_multiple_fields
|
125
|
+
assert_equal Post.all.count, DATA[:posts].count
|
126
|
+
|
127
|
+
expected = DATA[:posts].sort_by{|item| [item.b, item.a] }
|
128
|
+
|
129
|
+
sorted = PostWithBaseOrderA.all.sort_order([:b, :a], :asc)
|
130
|
+
|
131
|
+
sorted.each_with_index do |item, i|
|
132
|
+
assert_equal expected[i].id, item.id
|
133
|
+
end
|
134
|
+
|
135
|
+
expected = DATA[:posts].sort_by{|item| [item.b, item.a] }.reverse
|
136
|
+
|
137
|
+
sorted = PostWithBaseOrderA.all.sort_order([:b, :a], :desc)
|
138
|
+
|
139
|
+
sorted.each_with_index do |item, i|
|
140
|
+
assert_equal expected[i].id, item.id
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
124
144
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_sort_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|