apicasso 0.7.1 → 0.7.2

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: 810b5957d80a9681e838d2e7efcc9d02ff0bc4c91ed0ad6156f58517aac54139
4
- data.tar.gz: 34a5aeb6ede33634cf03155ab61ed849e39d12e09be73cc3594b6226f554d144
3
+ metadata.gz: 34fb159f9a8848d86bdefa10d316ef4e327620f7c5a6e645a0585608853ad8ef
4
+ data.tar.gz: 67c3675ddb57dcdd6ef6e5aaa5bc8078425b0921bd24e118b123288926bbaf7d
5
5
  SHA512:
6
- metadata.gz: a94dee1047d8ddd8d5af90d6232de8d56e6724aeb2fc156fc7e4479e99251a9fbf54618812f5147cb832ee40b3a006add80b47ceeb2937f9c82cce0d167504b3
7
- data.tar.gz: 83ecc747872fcf84f21835ad586b8140a6b7898bda2ae988792d1382c77b7a49fc255f0a765e7b2712ed55da1428d50ed4701f637021b9674de821ce1fa3358b
6
+ metadata.gz: da0659b481e87a0192ff45872b8c407eddcf7321c174aad5bca955c68aaeb6b5d21e50db7321a20137e70dd5492430466726b1c72b02552fed14b254fbb6b798
7
+ data.tar.gz: e919eb141396a0acbf908f3d067d516af8818a0abe814c48d1015d837f2083d5972256c76c74020670371d1f078abd916c83639d8524cf2b92a59f40903c2a41
@@ -97,8 +97,8 @@ module Apicasso
97
97
  # going to be rendered, if authorized
98
98
  def set_records
99
99
  authorize! :read, resource.name.underscore.to_sym
100
- @records = resource.ransack(parsed_query).result
101
- @object = resource.new
100
+ @records = request_collection.ransack(parsed_query).result
101
+ @object = request_collection.new
102
102
  key_scope_records
103
103
  reorder_records if params[:sort].present?
104
104
  select_fields if params[:select].present?
@@ -182,7 +182,16 @@ module Apicasso
182
182
 
183
183
  # Setup to stablish the nested model to be queried
184
184
  def set_nested_resource
185
- @nested_resource = @object.send(params[:nested].underscore.pluralize)
185
+ @nested_resource = request_collection.klass
186
+ end
187
+
188
+ # Gets the collection of objects based on request
189
+ def request_collection
190
+ if params[:nested].present?
191
+ @object.send(params[:nested].underscore.pluralize)
192
+ else
193
+ resource
194
+ end
186
195
  end
187
196
  end
188
197
  end
@@ -3,5 +3,5 @@
3
3
  # A Module to rule them all...
4
4
  module Apicasso
5
5
  # Current gem version
6
- VERSION = '0.7.1'.freeze
6
+ VERSION = '0.7.2'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apicasso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Bellincanta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-17 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler