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: 7f52e4133ad57ebbc7d450e671fe81edbc436fc5
4
- data.tar.gz: fb58e9461e53d8587143547c6bc6c691b0b3f8ea
3
+ metadata.gz: d203ec2973f8d587f9a6400b2879ce251828dc73
4
+ data.tar.gz: 565b3d5665d60e24499e3dee73e359b9079a95c8
5
5
  SHA512:
6
- metadata.gz: '09dee995fa7fca189fa57640d66b5188876c44895756e2a7c6d126448cbc6b47ffe24002dd726fdf8f6e66bbe076e53044b20ac3978cf4a3fcc80c62a8666fcc'
7
- data.tar.gz: 68348d492b7357a5ec85d20b928cebc7283aacb386ccf816cce7142bbb2df0400b49c4f994b0b832b7aacf776db987335f8a434b5f26f3e3cef728a39f3e798c
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
@@ -1,3 +1,3 @@
1
1
  module Apicasso
2
- VERSION = '0.2.11'
2
+ VERSION = '0.2.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apicasso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Bellincanta