api-pagination 4.8.0 → 4.8.1

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: 9027303d9da656103e61812aded61149a601a27dbc398d40d44d2952242fbb6d
4
- data.tar.gz: 5758331c124689a6160d6b787409bb8abfbba83213e201289c227f624afe7db5
3
+ metadata.gz: 3bb99a6e4283fff7d5fa69b46f58e2b464817aa85a9377c0dee0712ec53e2966
4
+ data.tar.gz: ea909de1558e7d1db8492b61cb6140acaf4b97431d77716995fd9878f4c47b1b
5
5
  SHA512:
6
- metadata.gz: 7ae4651a31cfbe45a02ffc9da7376c30ef5400d30265528de8f39130924fbef327d7158aedfe21fe7c24899c3632a14161bfc4392f8ab69fc167c21d4de608be
7
- data.tar.gz: 842bb2e7b03046cbacfbfed1dc8ea6c4ebc435f7a91423d98f844dde5a2128573cd21bda81d5813a8e813abfb0154f22e0fc0436033923ddd4af04f96888f0ea
6
+ metadata.gz: 3d648ef5559a8200612186dac182f1fee3b8babb294c54762e241f41b9e7f4ffc673ba21aa51ece2dff4bfa39a17bf6b9f78d3a44bd52d2f581aba63e7a4051f
7
+ data.tar.gz: 0c90a0cb15d533248f848fb590694a190b62eb13df4ddea426889740d848e9ed0d9eac64d7a5dc40b5aec222d995f91fac8070d60eea0ae3750cb6d0f48220ef
@@ -21,7 +21,7 @@ module ApiPagination
21
21
  end
22
22
 
23
23
  def pages_from(collection, options = {})
24
- return pagy_pages_from(collection) if collection.is_a?(Pagy)
24
+ return pagy_pages_from(collection) if ApiPagination.config.paginator == :pagy && collection.is_a?(Pagy)
25
25
 
26
26
  {}.tap do |pages|
27
27
  unless collection.first_page?
@@ -64,7 +64,8 @@ module ApiPagination
64
64
  end
65
65
 
66
66
  def pagy_from(collection, options)
67
- Pagy.new(count: collection.count, items: options[:per_page], page: options[:page])
67
+ count = collection.is_a?(Array) ? collection.count : collection.count(:all)
68
+ Pagy.new(count: count, items: options[:per_page], page: options[:page])
68
69
  end
69
70
 
70
71
  def pagy_pages_from(pagy)
@@ -2,7 +2,7 @@ module ApiPagination
2
2
  class Version
3
3
  MAJOR = 4
4
4
  MINOR = 8
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-09 00:00:00.000000000 Z
11
+ date: 2018-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec