kaminari-activerecord 1.2.0 → 1.2.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: df68cbe8dbf5e813cf9695d7b7f89c432005701347017ae25e8711646ea9d21e
4
- data.tar.gz: 6f7d3965cc8849695ed7e8b495b0040f3405a7669ff1333dc570af4d10620942
3
+ metadata.gz: 6876071aa2d14ad868c0b30fe2d47478c6237c8d2e32f5e09ff2d6406d308f8c
4
+ data.tar.gz: 9ab1589acaec71a5ad35eeb9f80b38d7d6abcfd4f9ee83a468ab9686e8bcb2e1
5
5
  SHA512:
6
- metadata.gz: 277cb5b789e37e8889f66e03f5aaec7ee06f04c3230630a0d9c06ca242c2a29545eee91f0bf8262d3d7fa8229dcf77714bc095a6925f886716af3fef2ce497ec
7
- data.tar.gz: b240655b581ed051c18831dfad97d5207cb02d41eaed7db3bcf95932fff8a7acc64df18bb21776eb9d63f4792f05912b8e7ad4566e8edba6531655cbbda62f32
6
+ metadata.gz: dc82c0b5e7aa6292bdbe94474b1a7c532706a6d07886a7a44134e49d593102d21a052a29cbd8edf187b7b1a0e736a1638bdd92fcfa7fe3bc4a6b54b2fb73599f
7
+ data.tar.gz: 7c6904976fdc124170c8b01294dacca2433e86895f60f7a1cabfccfd780cfac2f59263cd1777dc70cbf74e745939174b5ee29eee7df20909eca537b45172e001
@@ -32,12 +32,15 @@ module Kaminari
32
32
 
33
33
  c = c.limit(max_pages * limit_value) if max_pages && max_pages.respond_to?(:*)
34
34
 
35
- # Handle grouping with a subquery
36
- @total_count = if c.group_values.any?
37
- c.model.from(c.except(:select).select("1")).count
38
- else
39
- c.count(column_name)
40
- end
35
+ # .group returns an OrderedHash that responds to #count
36
+ c = c.count(column_name)
37
+ @total_count = if c.is_a?(Hash) || c.is_a?(ActiveSupport::OrderedHash)
38
+ c.count
39
+ elsif c.respond_to? :count
40
+ c.count(column_name)
41
+ else
42
+ c
43
+ end
41
44
  end
42
45
 
43
46
  # Turn this Relation to a "without count mode" Relation.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kaminari
4
4
  module Activerecord
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.2.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: 1.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.1.2
104
+ rubygems_version: 3.2.0.pre1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Kaminari Active Record adapter