pagy_cursor 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +9 -4
- data/.github/workflows/gempush.yml +2 -2
- data/Gemfile.lock +4 -0
- data/README.md +2 -1
- data/lib/pagy_cursor/pagy/extras/uuid_cursor.rb +16 -3
- data/lib/pagy_cursor/version.rb +1 -1
- 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: aeef340ec1e16f142493c13d33e9aff54b231be6e6bccbcd54407feafe8ee392
|
4
|
+
data.tar.gz: 6e4f963a7cc5ae9d19c6a07327464989081e69bfc6c431fa672aad91dded0af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d78438ba52a1287c0c445d4e59a7688bf625116cd54468a6e879f2871361f9d3a2731c150ddb1c40f0c29c3dfdea387f0812cc2b20136ccdf4d511777565494b
|
7
|
+
data.tar.gz: 5f0498e40683a5e51caa923845e56fcf9d9633f6cb22b48c5fb9453bffbf5007f43ca7e5e24ae65de194c68fe1bfe3d6e90d70783a877ec69fb4b73c00734cc2
|
data/.github/workflows/ci.yml
CHANGED
@@ -34,12 +34,14 @@ jobs:
|
|
34
34
|
- ruby-version: 3.1
|
35
35
|
env:
|
36
36
|
BUNDLE_GEMFILE: gemfiles/active_record_70.gemfile
|
37
|
-
|
37
|
+
- ruby-version: 3.2
|
38
|
+
env:
|
39
|
+
BUNDLE_GEMFILE: gemfiles/active_record_70.gemfile
|
38
40
|
fail-fast: false
|
39
41
|
env: ${{ matrix.env }}
|
40
42
|
|
41
43
|
steps:
|
42
|
-
- uses: actions/checkout@
|
44
|
+
- uses: actions/checkout@v3
|
43
45
|
|
44
46
|
- name: Set up ruby
|
45
47
|
uses: ruby/setup-ruby@v1
|
@@ -74,16 +76,19 @@ jobs:
|
|
74
76
|
- ruby-version: 2.7
|
75
77
|
env:
|
76
78
|
BUNDLE_GEMFILE: gemfiles/active_record_52.gemfile
|
77
|
-
- ruby-version: 3.0
|
79
|
+
- ruby-version: "3.0"
|
78
80
|
env:
|
79
81
|
BUNDLE_GEMFILE: gemfiles/active_record_61.gemfile
|
80
82
|
- ruby-version: 3.1
|
81
83
|
env:
|
82
84
|
BUNDLE_GEMFILE: gemfiles/active_record_70.gemfile
|
85
|
+
- ruby-version: 3.2
|
86
|
+
env:
|
87
|
+
BUNDLE_GEMFILE: gemfiles/active_record_70.gemfile
|
83
88
|
fail-fast: false
|
84
89
|
env: ${{ matrix.env }}
|
85
90
|
steps:
|
86
|
-
- uses: actions/checkout@
|
91
|
+
- uses: actions/checkout@v3
|
87
92
|
|
88
93
|
- name: Set up ruby
|
89
94
|
uses: ruby/setup-ruby@v1
|
data/Gemfile.lock
CHANGED
@@ -106,6 +106,8 @@ GEM
|
|
106
106
|
net-smtp (0.3.3)
|
107
107
|
net-protocol
|
108
108
|
nio4r (2.5.9)
|
109
|
+
nokogiri (1.14.3-arm64-darwin)
|
110
|
+
racc (~> 1.4)
|
109
111
|
nokogiri (1.14.3-x86_64-darwin)
|
110
112
|
racc (~> 1.4)
|
111
113
|
pagy (6.0.3)
|
@@ -157,6 +159,7 @@ GEM
|
|
157
159
|
diff-lcs (>= 1.2.0, < 2.0)
|
158
160
|
rspec-support (~> 3.12.0)
|
159
161
|
rspec-support (3.12.0)
|
162
|
+
sqlite3 (1.6.2-arm64-darwin)
|
160
163
|
sqlite3 (1.6.2-x86_64-darwin)
|
161
164
|
thor (1.2.1)
|
162
165
|
timeout (0.3.2)
|
@@ -168,6 +171,7 @@ GEM
|
|
168
171
|
zeitwerk (2.6.7)
|
169
172
|
|
170
173
|
PLATFORMS
|
174
|
+
arm64-darwin-21
|
171
175
|
x86_64-darwin-19
|
172
176
|
|
173
177
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -55,6 +55,7 @@ pagy_cursor(Post.all, after: 10, order: {updated_at: :desc})
|
|
55
55
|
|
56
56
|
Many thanks to:
|
57
57
|
- [Uysim](https://github.com/Uysim)
|
58
|
+
- [Hirokazu Hata](https://github.com/h-michael)
|
58
59
|
- [M. Yunan Helmy](https://github.com/yunanhelmy)
|
59
60
|
- [Eumir Gaspar](https://github.com/corroded)
|
60
61
|
|
@@ -73,7 +74,7 @@ To run tests in root folder of gem:
|
|
73
74
|
- ```bundle exec rspec ```
|
74
75
|
|
75
76
|
To test on specific Rails version
|
76
|
-
```export BUNDLE_GEMFILE=gemfiles/
|
77
|
+
```export BUNDLE_GEMFILE=gemfiles/active_record_70.gemfile``` to work with Rails 7
|
77
78
|
|
78
79
|
To play with app cd test/dummy and rails s -b 0.0.0.0 (before rails db:migrate).
|
79
80
|
|
@@ -23,9 +23,22 @@ class Pagy
|
|
23
23
|
if position.present?
|
24
24
|
arel_table = pagy.arel_table
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
# If the primary sort key is not "created_at"
|
27
|
+
|
28
|
+
# Select the primary sort key
|
29
|
+
# pagy.order should be something like:
|
30
|
+
# [:created_at, :id] or [:foo_column, ..., :created_at, :id]
|
31
|
+
primary_sort_key = pagy.order.keys.detect{ |order_key| ![:created_at, :id].include?(order_key.to_sym) } || :created_at
|
32
|
+
|
33
|
+
select_previous_row = arel_table.project(arel_table[primary_sort_key]).
|
34
|
+
where(arel_table[pagy.primary_key].eq(position))
|
35
|
+
|
36
|
+
sql_comparation = arel_table[primary_sort_key].
|
37
|
+
send(pagy.comparation, select_previous_row).
|
38
|
+
or(
|
39
|
+
arel_table[primary_sort_key].eq(select_previous_row).
|
40
|
+
and(arel_table[pagy.primary_key].send(pagy.comparation, position))
|
41
|
+
)
|
29
42
|
|
30
43
|
collection = collection.where(sql_comparation)
|
31
44
|
end
|
data/lib/pagy_cursor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy_cursor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uysim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pagy
|