active_model_serializers_contrib 0.1.1 → 0.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdd70f3e45a996cf465f332cc8d8a44614d0e682
|
4
|
+
data.tar.gz: 0dbf09f444df01744a64b60a7c7820de728af3b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4cbc332d6f879b558dbdeac44b2d89d51e797e363b9248592af41fb8441c0384113c848c1da5bd2f941562436d54150f7cb91f19f8dbf51e38949e29e248f82
|
7
|
+
data.tar.gz: 29ece20677667f2c6f649036b38115ac0fc6c0cb98ca4c9e4ff33bb1bb6530dc4bd36895196334bb857758cf1c9de123ec319cf96842b6a46df315dfde3704f5
|
@@ -4,7 +4,7 @@ class ActiveModel::PaginationSerializer < ActiveModel::ArraySerializer
|
|
4
4
|
per_page = object.limit_value
|
5
5
|
offset = object.offset_value
|
6
6
|
current_page = offset ? (offset / per_page) + 1 : 1
|
7
|
-
total_items = object.limit(nil).offset(nil).count
|
7
|
+
total_items = object.limit(nil).offset(nil).count(:all)
|
8
8
|
total_pages = per_page ? (total_items / per_page.to_f).ceil : 1
|
9
9
|
prev_page = current_page - 1
|
10
10
|
prev_page = nil if prev_page < 1
|
@@ -17,6 +17,7 @@ class ActiveModel::PaginationSerializer < ActiveModel::ArraySerializer
|
|
17
17
|
opts[:meta][:total_items] = total_items
|
18
18
|
opts[:meta][:prev_page] = prev_page
|
19
19
|
opts[:meta][:next_page] = next_page
|
20
|
+
opts[:meta][:per_page] = per_page
|
20
21
|
|
21
22
|
initialize_without_pagination(object, opts)
|
22
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_serializers_contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- G5
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_model_serializers
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.4.
|
161
|
+
rubygems_version: 2.4.8
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Modules/classes that extend AMS with more functionality
|