rao-resources_controller 0.0.22.pre → 0.0.23.pre
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412f93abb3a7cbe7ac330669de53922a68af511670f948d04e9f31c6e9ff2570
|
4
|
+
data.tar.gz: d4f22d1f199829d1ade3a72493743a6d00a48025c0ac9b6dcc5e7638a5f54b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80593943db9b36a0e1d2455bb83cab1f74c7aa0360f2d99bd4c54416fdca5bd0888c7e17e9bd683b63a38f7654d7c0b9671612e281a958539dabc910de7e0ed3
|
7
|
+
data.tar.gz: d6016ff1546ba449c51b5b375d760ac43ba569ff2d3cc06ef0117d6e97bd956851af6fc506e09308b54a667730360047e8dbe7c67206bc8fc6c341be0b5b441b
|
@@ -17,10 +17,18 @@ module Rao
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def per_page
|
20
|
-
if
|
21
|
-
|
20
|
+
# Return page size from configuration if per_page is not present in params
|
21
|
+
unless params.has_key?(:per_page)
|
22
|
+
return Rao::ResourcesController::Configuration.pagination_per_page_default
|
23
|
+
end
|
24
|
+
|
25
|
+
# Return count of all records or nil if no records present if
|
26
|
+
# params[:per_page] equals 'all'. Otherwise return params[:per_page]
|
27
|
+
if params[:per_page] == 'all'
|
28
|
+
count = load_collection_scope.count
|
29
|
+
count > 0 ? count : nil
|
22
30
|
else
|
23
|
-
|
31
|
+
params[:per_page]
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
@@ -19,11 +19,19 @@ module Rao
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def per_page
|
22
|
-
if
|
23
|
-
|
24
|
-
else
|
22
|
+
# Return page size from configuration if per_page is not present in params
|
23
|
+
unless params.has_key?(:per_page)
|
25
24
|
Rao::ResourcesController::Configuration.pagination_per_page_default
|
26
25
|
end
|
26
|
+
|
27
|
+
# Return count of all records or nil if no records present if
|
28
|
+
# params[:per_page] equals 'all'. Otherwise return params[:per_page]
|
29
|
+
if params[:per_page] == 'all'
|
30
|
+
count = load_collection_scope.count
|
31
|
+
count > 0 ? count : nil
|
32
|
+
else
|
33
|
+
params[:per_page]
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
29
37
|
end
|