pagy 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pagy.rb +1 -1
- data/lib/pagy/backend.rb +3 -2
- 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: 3a66c2944b27ed7d4ce4f4ab521cd8bc45fc675196ca79bcc352f65e5cb8584e
|
4
|
+
data.tar.gz: 6a2aee40334e9b80291b74b840776ed4f9697afaa4ce4701c61ade1fa8b35349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6bfadbdf1ff037faf2e1bc29e01c4f3fe488983c3c0eb2da2cfb474b3cd38025704773d38ad903c436f97a2e810e99537134e6ab6660257311df5133d3d176c
|
7
|
+
data.tar.gz: 1a9949404e19dddb77f790147f3cf732ccbfbaf1d20083b963a164344f4154aacf40d4f2f0632284109c17830c20d99c92767a473f649a502a2f0771dcbca509
|
data/lib/pagy.rb
CHANGED
data/lib/pagy/backend.rb
CHANGED
@@ -16,9 +16,10 @@ class Pagy
|
|
16
16
|
|
17
17
|
# Sub-method called only by #pagy: here for easy customization of variables by overriding
|
18
18
|
def pagy_get_vars(collection, vars)
|
19
|
+
count = collection.count(:all) # work with AR collections: other ORMs may need to change this
|
20
|
+
count = count.count if count.is_a?(Hash) # fix for the AR grouping count inconsistency (Hash instead of Integer)
|
19
21
|
# Return the merged variables to initialize the Pagy object
|
20
|
-
{ count:
|
21
|
-
page: params[vars[:page_param]||VARS[:page_param]] }.merge!(vars)
|
22
|
+
{ count: count, page: params[vars[:page_param]||VARS[:page_param]] }.merge!(vars)
|
22
23
|
end
|
23
24
|
|
24
25
|
# Sub-method called only by #pagy: here for easy customization of record-extraction by overriding
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
|
14
14
|
and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,
|