thecore_api 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/base_controller.rb +5 -3
- data/lib/thecore_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619b07b5b7dc5350433696280e6ef41c2d958db2ec15e9de1b7ed5524a1da0ad
|
4
|
+
data.tar.gz: 5f4a09a94de772c71d71bef1abe8c89d1102c6c0b59e3d201b61fa559d7556d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c50e21fee8faba7b2192db8f8cd604c100bb86a1bfd6be0cdb2eb18664a6e4c1fd5f85116e626743a515bbb05d083a7e90c8414728b032d3fada5a4e1edb0533
|
7
|
+
data.tar.gz: 3b2dfc5b563791c97be3c6613418bc26f192ecc5e71166d4f46685f4416f6c327e93b25f4886c3d3cc45d1c3cd6221ae484b49b24143142da01149ad38d00647
|
@@ -104,12 +104,14 @@ class Api::V1::BaseController < ActionController::API
|
|
104
104
|
pages_count: @records.total_pages,
|
105
105
|
current_page_number: @records.current_page
|
106
106
|
}) if !pages_info.blank?
|
107
|
-
|
108
|
-
|
107
|
+
|
108
|
+
status = @records_all.blank? ? 404 : 200
|
109
|
+
# If it's asked for page number, then paginate
|
110
|
+
return render json: MultiJson.dump(@records, json_attrs), status: status if !page.blank? # (@json_attrs || {})
|
109
111
|
# if you ask for count, then return a json object with just the number of objects
|
110
112
|
return render json: MultiJson.dump({count: @records_all.count}) if !count.blank?
|
111
113
|
# Default
|
112
|
-
render json: MultiJson.dump(@records_all, json_attrs) #(@json_attrs || {})
|
114
|
+
render json: MultiJson.dump(@records_all, json_attrs), status: status #(@json_attrs || {})
|
113
115
|
end
|
114
116
|
|
115
117
|
# def count
|
data/lib/thecore_api/version.rb
CHANGED