pagy 0.10.0 → 0.10.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pagy.rb +1 -1
  3. data/lib/pagy/backend.rb +3 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f42ebff94cf9faa8dadd414d3fd056bcf57da0a2e4930f1a9850d64eca08adf4
4
- data.tar.gz: 60133804f52c4c687647d2c8b48f2b7344a558fa163063857f24bc0387d41834
3
+ metadata.gz: 3a66c2944b27ed7d4ce4f4ab521cd8bc45fc675196ca79bcc352f65e5cb8584e
4
+ data.tar.gz: 6a2aee40334e9b80291b74b840776ed4f9697afaa4ce4701c61ade1fa8b35349
5
5
  SHA512:
6
- metadata.gz: b6dbcbc1041dceb8ff23832f687083e701d3eb187fabddd1051bf3672c1e93efbe4b680c534dd531d506c173f7766cba96473ac8bc5464da8db25206a9c9ee9b
7
- data.tar.gz: 256e4e8eb88d53c71fe035804e6ad99af606f93fc673d7173150e4ac13e396c084eda16686d52c144ea3d5af7cca29797ddca5d0be21aac87406cc7654757171
6
+ metadata.gz: a6bfadbdf1ff037faf2e1bc29e01c4f3fe488983c3c0eb2da2cfb474b3cd38025704773d38ad903c436f97a2e810e99537134e6ab6660257311df5133d3d176c
7
+ data.tar.gz: 1a9949404e19dddb77f790147f3cf732ccbfbaf1d20083b963a164344f4154aacf40d4f2f0632284109c17830c20d99c92767a473f649a502a2f0771dcbca509
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- class Pagy ; VERSION = '0.10.0'
6
+ class Pagy ; VERSION = '0.10.1'
7
7
 
8
8
  class OutOfRangeError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
9
9
 
@@ -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: collection.count(:all), # works with AR, but may not work with other ORMs
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.0
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-21 00:00:00.000000000 Z
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,