jsonapi-resources 0.9.7 → 0.9.8

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: 3fc3aa84a3eee153f95a97c3d982e6fef51146998c0860ed4986f3c3911eb5c4
4
- data.tar.gz: c75e87dad876b378b4aef634c7103b6399b171b8392831b1a0365146c82c02f9
3
+ metadata.gz: 180872f33ad6e44850227f9cf657698541cfdc495bba54b818f2be82591ffbe4
4
+ data.tar.gz: e524645c43739882441606fe00d272092177f4b792d6a6f5d4fc09f444eef073
5
5
  SHA512:
6
- metadata.gz: a35bf550f5cdd014236b4ec680526bc1041a024644ba83a036e1d57c2c7e837456f713ad7f3f4bca95bacf7cc50bc7588fcfdf3550c96eb3802bf086a48dac43
7
- data.tar.gz: b322f9b3d22e6a3667f4b938559c3cf73af93fc54ad18311b443acafce36594cac7e2c8166c3b204e9ef50b07cb39f17b39edcbfa342d7a41434b359e7c9bd35
6
+ metadata.gz: 7048b19d34a04968deee31dd728373abf15c4707ec937544479e68129f0caeb14a7199b2195b9c2944f57887f76d34527e49a3e30a9d1afe2c6739a29ca1c40c
7
+ data.tar.gz: 2d9c25c7775f7eeae4f73c2129cd60b16e44fe1c419915e02ba30ea0dbda49f60db3f176d640d535544fd5191551d0e7ea49df0ccc44e875659155a7e98abf3d
@@ -150,12 +150,14 @@ module JSONAPI
150
150
 
151
151
  def related_url_helper_name(relationship)
152
152
  relationship_parts = resource_path_parts_from_class(relationship.parent_resource)
153
+ relationship_parts << "related"
153
154
  relationship_parts << relationship.name
154
155
  url_helper_name_from_parts(relationship_parts)
155
156
  end
156
157
 
157
158
  def singleton_related_url_helper_name(relationship)
158
159
  relationship_parts = []
160
+ relationship_parts << "related"
159
161
  relationship_parts << relationship.name
160
162
  relationship_parts += resource_path_parts_from_class(relationship.parent_resource)
161
163
  url_helper_name_from_parts(relationship_parts)
@@ -680,7 +680,7 @@ module JSONAPI
680
680
  include_directives = options[:include_directives]
681
681
  if include_directives
682
682
  model_includes = resolve_relationship_names_to_relations(self, include_directives.model_includes, options)
683
- records = records.includes(model_includes)
683
+ records = records.includes(model_includes) if model_includes.present?
684
684
  end
685
685
 
686
686
  records
@@ -418,6 +418,7 @@ module JSONAPI
418
418
  [obj.type.underscore.pluralize, obj.id]
419
419
  end
420
420
  else
421
+ assoc = assoc.unscope(:includes) if assoc.is_a?(ActiveRecord::Relation)
421
422
  assoc.pluck(:type, :id).map do |type, id|
422
423
  [type.underscore.pluralize, id]
423
424
  end
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = '0.9.7'
3
+ VERSION = '0.9.8'
4
4
  end
5
5
  end
@@ -235,7 +235,7 @@ module ActionDispatch
235
235
  match formatted_relationship_name, controller: options[:controller],
236
236
  relationship: relationship.name, source: resource_type_with_module_prefix(source._type),
237
237
  action: 'get_related_resource', via: [:get],
238
- as: relationship_name
238
+ as: "related/#{relationship_name}"
239
239
  end
240
240
 
241
241
  def jsonapi_related_resources(*relationship)
@@ -253,7 +253,7 @@ module ActionDispatch
253
253
  controller: options[:controller],
254
254
  relationship: relationship.name, source: resource_type_with_module_prefix(source._type),
255
255
  action: 'get_related_resources', via: [:get],
256
- as: relationship_name
256
+ as: "related/#{relationship_name}"
257
257
  end
258
258
 
259
259
  protected
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-18 00:00:00.000000000 Z
12
+ date: 2019-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler