fast_page 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/fast_page/active_record_methods.rb +10 -0
- data/lib/fast_page/version.rb +1 -1
- 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: 5cbe26206c49286c01fcab014490db153e8f365e3b8e4338e5bfba6bf6085883
|
4
|
+
data.tar.gz: 89d213a8260026721de817d56f9692d5691ccd250aeee229dad86d9fe2f6a7e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47a1122b7eddcc8e1eb4961c5abb5f56926b39255ee3be5321a8a56541a2bdfd7b1de4bb4e714469412238d1c8253d3e891444408694c402dbc86718048a202d
|
7
|
+
data.tar.gz: 1242c919d036ccc33de101a41358fa7de1150e5a253deead5d538cb6bdce164554fbc4de8cf8d749693de9940dfbf1d725d111f9498b7037eee388c612129d71
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,10 +6,20 @@ module FastPage
|
|
6
6
|
# Must have a limit or offset defined
|
7
7
|
raise ArgumentError, "You must specify a limit or offset to use fast_page" if !limit_value && !offset_value
|
8
8
|
|
9
|
+
# We load 1 additional record to determine if there is a next page.
|
10
|
+
# This helps us avoid doing a count over all records
|
11
|
+
@values[:limit] = limit_value + 1 if limit_value
|
9
12
|
id_scope = dup
|
10
13
|
id_scope = id_scope.except(:includes) unless references_eager_loaded_tables?
|
11
14
|
ids = id_scope.pluck(:id)
|
12
15
|
|
16
|
+
if limit_value
|
17
|
+
@values[:limit] = limit_value - 1
|
18
|
+
# Record if there is a next page
|
19
|
+
@_has_next = ids.length > limit_value
|
20
|
+
ids = ids.first(limit_value)
|
21
|
+
end
|
22
|
+
|
13
23
|
if ids.empty?
|
14
24
|
@records = []
|
15
25
|
@loaded = true
|
data/lib/fast_page/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Coutermarsh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|