kaminari-activerecord 1.0.0.rc1 → 1.0.0

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
  SHA1:
3
- metadata.gz: d2a91cf39e49f1e5075665a821d66ddd6894e908
4
- data.tar.gz: e537ec8d5f281607dc88314f4c4065b12a996ef4
3
+ metadata.gz: 711c45636af3a883dd3423099b806119be97de69
4
+ data.tar.gz: c6e2277873dc10069fd8e25f7f7aae3fab3264bc
5
5
  SHA512:
6
- metadata.gz: b016210acb39836dd3fe42d1626c488c7eba63ab38eb70ada6e2e16ddf65de8cea4b4d15c36f4d17ee6f8ab135438bfa55a1f15c2550bc8850fdca082c9ae75a
7
- data.tar.gz: 36cc372bdaf202992e67aca716603977e834de447718b0c717501c88ead143dd6ed5a54968a6de7b2fc9a0a3c71292aa220eb17b71c8066cd97a722cda412ff7
6
+ metadata.gz: fc118f1c18bf2f7d721e13d84451ce9b06e669a64c22aecec81251208f06ff34d58a7b2e17cd1223b44de3daafeb7e179670bf474d616778414bbf953753afdf
7
+ data.tar.gz: 5e0974d4ac02e0d9e37be7b6c0e61121e14811862c9e5b7ed6b403359aa607d81796a1a59f303be4c8cce120b9b519c8c6d24b7b7746795917226c70a19d2508
@@ -20,8 +20,9 @@ module Kaminari
20
20
  if loaded?
21
21
  # Total count has to be 0 if loaded records are 0
22
22
  return @total_count = 0 if (current_page == 1) && @records.empty?
23
- # Total count is calculatable at the last page
24
- return @total_count = (current_page - 1) * @_per + @records.length if defined?(@_per) && (@records.length < @_per)
23
+ # Total count is calculable at the last page
24
+ per_page = (defined?(@_per) && @_per) || default_per_page
25
+ return @total_count = (current_page - 1) * per_page + @records.length if @records.any? && (@records.length < per_page)
25
26
  end
26
27
 
27
28
  # #count overrides the #select which could include generated columns referenced in #order, so skip #order here, where it's irrelevant to the result anyway
@@ -55,8 +56,12 @@ module Kaminari
55
56
  super
56
57
  else
57
58
  @values[:limit] = limit_value + 1
59
+ # FIXME: this could be removed when we're dropping AR 4 support
60
+ @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)
58
61
  super
59
62
  @values[:limit] = limit_value - 1
63
+ # FIXME: this could be removed when we're dropping AR 4 support
64
+ @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)
60
65
 
61
66
  if @records.any?
62
67
  @records = @records.dup if (frozen = @records.frozen?)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Kaminari
3
3
  module Activerecord
4
- VERSION = '1.0.0.rc1'
4
+ VERSION = '1.0.0'
5
5
  end
6
6
  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.0.0.rc1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-14 00:00:00.000000000 Z
11
+ date: 2017-01-10 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.0.0.rc1
19
+ version: 1.0.0
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.0.0.rc1
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,9 +96,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">"
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 1.3.1
101
+ version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
104
  rubygems_version: 2.6.8