apicasso 0.2.11 → 0.2.12
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: d203ec2973f8d587f9a6400b2879ce251828dc73
|
4
|
+
data.tar.gz: 565b3d5665d60e24499e3dee73e359b9079a95c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c197803064d3cec84253b9579f83f62ae3320a1e8693253b0820998c04a7943bd030ab09900f948b217b66484731885bd08ed24febd50ccc2d7e051c6b8927d9
|
7
|
+
data.tar.gz: c50a86f7b2cca4776d76ed343430fd919b8eaec26d60c2edd639cc5c7289d74c0f7878e7ca64999cb7e512e455a1ee3aebc577ceb37dde2fae856c5c8fa44806
|
@@ -66,6 +66,12 @@ module Apicasso
|
|
66
66
|
[]
|
67
67
|
end
|
68
68
|
|
69
|
+
def parsed_select
|
70
|
+
params[:select].split(',')
|
71
|
+
rescue NoMethodError
|
72
|
+
[]
|
73
|
+
end
|
74
|
+
|
69
75
|
# Receives a `.paginate`d collection and returns the pagination
|
70
76
|
# metadata to be merged into response
|
71
77
|
def pagination_metadata_for(records)
|
@@ -28,7 +28,7 @@ module Apicasso
|
|
28
28
|
# relation/methods including on response
|
29
29
|
def show
|
30
30
|
set_access_control_headers
|
31
|
-
render json: @object.to_json(include: parsed_include)
|
31
|
+
render json: @object.to_json(include: parsed_include, only: parsed_select)
|
32
32
|
end
|
33
33
|
|
34
34
|
# PATCH/PUT /:resource/1
|
@@ -172,6 +172,8 @@ module Apicasso
|
|
172
172
|
# Parsed JSON to be used as response payload, with included relations
|
173
173
|
def include_relations
|
174
174
|
@records = JSON.parse(included_collection.to_json(include: parsed_include))
|
175
|
+
rescue ActiveRecord::AssociationNotFoundError
|
176
|
+
@records = JSON.parse(@records.to_json(include: parsed_include))
|
175
177
|
end
|
176
178
|
|
177
179
|
# A way to SQL-include for current param[:include], only if available
|
data/lib/apicasso/version.rb
CHANGED