miscellany 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d919e8dffeb9e12448e4e1a65f0e3c3015b9dd759164e746a59560af0797ea32
4
- data.tar.gz: dd0a2c007d8980d1dd7d5995571aa7a9e1a4346099c23c279fd4f7c853851535
3
+ metadata.gz: d8272b6520386bb2e45ef6a4ae8cc6c2c349e465ca8eea10867df3c42c80c7c3
4
+ data.tar.gz: aeb81bc5bb198c2f64589c1d416369bd101de5d1db074682e40f66247c2035d5
5
5
  SHA512:
6
- metadata.gz: 97f892b692386c7c924a2b082ddb34787a6870c9bad7cc378d426a6fe8e288a7d47f33b570596c4e948a24decc51882b9da859d8e9fef3d5cbe8ad13c49cecdf
7
- data.tar.gz: 0115b26046212f6d56bbac869097a3e7b69e2c2b1756d3b33b38a02b9b361df61c478f2d930f343577e53bc1f3181b83e9cbcee1be2e188e6640a38901b8c357
6
+ metadata.gz: 3f6ac9e74cacbdb4dd5d990a47c72608181eb005b4a9c3de81b46666bf314a246fa799c29d97753519822318740adf32fa2db63450d2d70e2abc4fb4a38c09de
7
+ data.tar.gz: 99f033c54af54257ef660e889f34f683e080fe4e16baeb9d1f201fcf0091561c6d2fd5d26b582a57b9ab91b2d7c0fd3c8e72f8fc8e02f7425b0a395b4bcc7e9f
@@ -198,7 +198,12 @@ module Miscellany
198
198
  elsif items.is_a?(ActiveRecord::Relation)
199
199
  offset, limit = slice_bounds
200
200
  limit -= offset unless limit.nil?
201
- items.order(Arel.sql(sort_sql)).limit(limit).offset(offset).to_a
201
+
202
+ query = items
203
+ sort_clause = sort_sql
204
+ query = query.order(Arel.sql(sort_clause)) if sort_clause.present?
205
+
206
+ query.limit(limit).offset(offset).to_a
202
207
  elsif defined?(Miscellany::ComplexQuery) && items.is_a?(Miscellany::ComplexQuery)
203
208
  offset, limit = slice_bounds
204
209
  limit -= offset unless limit.nil?
@@ -1,3 +1,3 @@
1
1
  module Miscellany
2
- VERSION = "0.1.16".freeze
2
+ VERSION = "0.1.17".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miscellany
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-22 00:00:00.000000000 Z
11
+ date: 2023-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails