jsonapi-resources 0.10.2 → 0.10.6

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: d101bf5764e1eb80096aeeed45eed01a532e183995908d9f66a2143cb78e24df
4
- data.tar.gz: 38911d1428d934a71d06bfac0ad0661a2faa25af2b5de9ac695ec5b620b4c011
3
+ metadata.gz: '091836afd689ed975ab1ad2cee54a467a0771cb5ea5b0bfa2055e25531809f74'
4
+ data.tar.gz: 96d46c67f8c88fa3e6d298eac85dc3862bef6feacbe8eddde1515b80e7c8e5a8
5
5
  SHA512:
6
- metadata.gz: 6ec8d28ba3b475796ba5947bec8f548c154acfbf73ae3af44c0c20516dd4b756a45d3cbd4797f0162bbdc288e0b055599ef5044f500babdcf19ced3509887021
7
- data.tar.gz: 4698f7ddd9b9893e310c00fde96d8fef84d0e79ad3261ed574b08c7b60d1e415f5565eb8620752d11136e16df63675c7923006ea6344805a1fd102634bd27e2d
6
+ metadata.gz: f4dfc6fd61f4a7d27a291626b00c6e5c13cad32be0b73b66e239f254800d73557168470191923cd5bcf29869bfdb1e93a11c4a8b6e3eca25411b1ac8dbc4e24d
7
+ data.tar.gz: e6c699748872330b22ae151082595e48bed10665e9c61c3ba902f585747090e19ab9319776d189bc06fe9ca7797f00467fb08a3e863a4ce7e3b740fd85bc2fe8
@@ -147,9 +147,15 @@ module JSONAPI
147
147
  related_resource_klass = join_details[:related_resource_klass]
148
148
  join_type = relationship_details[:join_type]
149
149
 
150
+ join_options = {
151
+ relationship: relationship,
152
+ relationship_details: relationship_details,
153
+ related_resource_klass: related_resource_klass,
154
+ }
155
+
150
156
  if relationship == :root
151
157
  unless source_relationship
152
- add_join_details('', {alias: resource_klass._table_name, join_type: :root})
158
+ add_join_details('', {alias: resource_klass._table_name, join_type: :root, join_options: join_options})
153
159
  end
154
160
  next
155
161
  end
@@ -163,7 +169,7 @@ module JSONAPI
163
169
  options: options)
164
170
  }
165
171
 
166
- details = {alias: self.class.alias_from_arel_node(join_node), join_type: join_type}
172
+ details = {alias: self.class.alias_from_arel_node(join_node), join_type: join_type, join_options: join_options}
167
173
 
168
174
  if relationship == source_relationship
169
175
  if relationship.polymorphic? && relationship.belongs_to?
@@ -114,11 +114,11 @@ module JSONAPI
114
114
  # This alias is going to be resolve down to the model's table name and will not actually be an alias
115
115
  resource_table_alias = resource_klass._table_name
116
116
 
117
- pluck_fields = [Arel.sql("#{concat_table_field(resource_table_alias, resource_klass._primary_key)} AS #{resource_table_alias}_#{resource_klass._primary_key}")]
117
+ pluck_fields = [sql_field_with_alias(resource_table_alias, resource_klass._primary_key)]
118
118
 
119
119
  cache_field = attribute_to_model_field(:_cache_field) if options[:cache]
120
120
  if cache_field
121
- pluck_fields << Arel.sql("#{concat_table_field(resource_table_alias, cache_field[:name])} AS #{resource_table_alias}_#{cache_field[:name]}")
121
+ pluck_fields << sql_field_with_alias(resource_table_alias, cache_field[:name])
122
122
  end
123
123
 
124
124
  linkage_fields = []
@@ -133,7 +133,7 @@ module JSONAPI
133
133
 
134
134
  linkage_table_alias = join_manager.join_details_by_polymorphic_relationship(linkage_relationship, resource_type)[:alias]
135
135
  primary_key = klass._primary_key
136
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
136
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
137
137
  end
138
138
  else
139
139
  klass = linkage_relationship.resource_klass
@@ -141,7 +141,7 @@ module JSONAPI
141
141
 
142
142
  linkage_table_alias = join_manager.join_details_by_relationship(linkage_relationship)[:alias]
143
143
  primary_key = klass._primary_key
144
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
144
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
145
145
  end
146
146
  end
147
147
 
@@ -150,7 +150,7 @@ module JSONAPI
150
150
  attributes.try(:each) do |attribute|
151
151
  model_field = resource_klass.attribute_to_model_field(attribute)
152
152
  model_fields[attribute] = model_field
153
- pluck_fields << Arel.sql("#{concat_table_field(resource_table_alias, model_field[:name])} AS #{resource_table_alias}_#{model_field[:name]}")
153
+ pluck_fields << sql_field_with_alias(resource_table_alias, model_field[:name])
154
154
  end
155
155
 
156
156
  sort_fields = options.dig(:_relation_helper_options, :sort_fields)
@@ -324,6 +324,11 @@ module JSONAPI
324
324
  records = records.joins_left(relation_name)
325
325
  end
326
326
  end
327
+
328
+ if relationship.use_related_resource_records_for_joins
329
+ records = records.merge(self.records(options))
330
+ end
331
+
327
332
  records
328
333
  end
329
334
 
@@ -395,7 +400,7 @@ module JSONAPI
395
400
  sort_criteria: sort_criteria,
396
401
  filters: filters)
397
402
 
398
- paginator = options[:paginator] if source_rids.count == 1
403
+ paginator = options[:paginator]
399
404
 
400
405
  records = apply_request_settings_to_records(records: records_for_source_to_related(options),
401
406
  resource_klass: resource_klass,
@@ -409,13 +414,13 @@ module JSONAPI
409
414
  resource_table_alias = join_manager.join_details_by_relationship(relationship)[:alias]
410
415
 
411
416
  pluck_fields = [
412
- Arel.sql("#{_table_name}.#{_primary_key} AS source_id"),
413
- Arel.sql("#{concat_table_field(resource_table_alias, resource_klass._primary_key)} AS #{resource_table_alias}_#{resource_klass._primary_key}")
417
+ Arel.sql("#{_table_name}.#{_primary_key} AS \"source_id\""),
418
+ sql_field_with_alias(resource_table_alias, resource_klass._primary_key)
414
419
  ]
415
420
 
416
421
  cache_field = resource_klass.attribute_to_model_field(:_cache_field) if options[:cache]
417
422
  if cache_field
418
- pluck_fields << Arel.sql("#{concat_table_field(resource_table_alias, cache_field[:name])} AS #{resource_table_alias}_#{cache_field[:name]}")
423
+ pluck_fields << sql_field_with_alias(resource_table_alias, cache_field[:name])
419
424
  end
420
425
 
421
426
  linkage_fields = []
@@ -430,7 +435,7 @@ module JSONAPI
430
435
 
431
436
  linkage_table_alias = join_manager.join_details_by_polymorphic_relationship(linkage_relationship, resource_type)[:alias]
432
437
  primary_key = klass._primary_key
433
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
438
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
434
439
  end
435
440
  else
436
441
  klass = linkage_relationship.resource_klass
@@ -438,7 +443,7 @@ module JSONAPI
438
443
 
439
444
  linkage_table_alias = join_manager.join_details_by_relationship(linkage_relationship)[:alias]
440
445
  primary_key = klass._primary_key
441
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
446
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
442
447
  end
443
448
  end
444
449
 
@@ -447,7 +452,7 @@ module JSONAPI
447
452
  attributes.try(:each) do |attribute|
448
453
  model_field = resource_klass.attribute_to_model_field(attribute)
449
454
  model_fields[attribute] = model_field
450
- pluck_fields << Arel.sql("#{concat_table_field(resource_table_alias, model_field[:name])} AS #{resource_table_alias}_#{model_field[:name]}")
455
+ pluck_fields << sql_field_with_alias(resource_table_alias, model_field[:name])
451
456
  end
452
457
 
453
458
  sort_fields = options.dig(:_relation_helper_options, :sort_fields)
@@ -525,7 +530,7 @@ module JSONAPI
525
530
  relationships: linkage_relationships,
526
531
  filters: filters)
527
532
 
528
- paginator = options[:paginator] if source_rids.count == 1
533
+ paginator = options[:paginator]
529
534
 
530
535
  # Note: We will sort by the source table. Without using unions we can't sort on a polymorphic relationship
531
536
  # in any manner that makes sense
@@ -543,9 +548,9 @@ module JSONAPI
543
548
  related_type = concat_table_field(_table_name, relationship.polymorphic_type)
544
549
 
545
550
  pluck_fields = [
546
- Arel.sql("#{primary_key} AS #{_table_name}_#{_primary_key}"),
547
- Arel.sql("#{related_key} AS #{_table_name}_#{relationship.foreign_key}"),
548
- Arel.sql("#{related_type} AS #{_table_name}_#{relationship.polymorphic_type}")
551
+ Arel.sql("#{primary_key} AS #{alias_table_field(_table_name, _primary_key)}"),
552
+ Arel.sql("#{related_key} AS #{alias_table_field(_table_name, relationship.foreign_key)}"),
553
+ Arel.sql("#{related_type} AS #{alias_table_field(_table_name, relationship.polymorphic_type)}")
549
554
  ]
550
555
 
551
556
  # Get the additional fields from each relation. There's a limitation that the fields must exist in each relation
@@ -570,7 +575,7 @@ module JSONAPI
570
575
 
571
576
  cache_offset = relation_index
572
577
  if cache_field
573
- pluck_fields << Arel.sql("#{concat_table_field(table_alias, cache_field[:name])} AS cache_#{type}_#{cache_field[:name]}")
578
+ pluck_fields << sql_field_with_alias(table_alias, cache_field[:name])
574
579
  relation_index+= 1
575
580
  end
576
581
 
@@ -579,7 +584,7 @@ module JSONAPI
579
584
  attributes.try(:each) do |attribute|
580
585
  model_field = related_klass.attribute_to_model_field(attribute)
581
586
  model_fields[attribute] = model_field
582
- pluck_fields << Arel.sql("#{concat_table_field(table_alias, model_field[:name])} AS #{table_alias}_#{model_field[:name]}")
587
+ pluck_fields << sql_field_with_alias(table_alias, model_field[:name])
583
588
  relation_index+= 1
584
589
  end
585
590
 
@@ -616,7 +621,7 @@ module JSONAPI
616
621
 
617
622
  linkage_table_alias = join_manager.join_details_by_polymorphic_relationship(linkage_relationship, resource_type)[:alias]
618
623
  primary_key = klass._primary_key
619
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
624
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
620
625
  end
621
626
  else
622
627
  klass = linkage_relationship.resource_klass
@@ -624,7 +629,7 @@ module JSONAPI
624
629
 
625
630
  linkage_table_alias = join_manager.join_details_by_relationship(linkage_relationship)[:alias]
626
631
  primary_key = klass._primary_key
627
- pluck_fields << Arel.sql("#{concat_table_field(linkage_table_alias, primary_key)} AS #{linkage_table_alias}_#{primary_key}")
632
+ pluck_fields << sql_field_with_alias(linkage_table_alias, primary_key)
628
633
  end
629
634
  end
630
635
 
@@ -649,7 +654,7 @@ module JSONAPI
649
654
  end
650
655
  end
651
656
 
652
- relation_position = relation_positions[row[2].downcase.pluralize]
657
+ relation_position = relation_positions[row[2].underscore.pluralize]
653
658
  model_fields = relation_position[:model_fields]
654
659
  cache_field = relation_position[:cache_field]
655
660
  cache_offset = relation_position[:cache_offset]
@@ -756,7 +761,7 @@ module JSONAPI
756
761
 
757
762
  # Assumes ActiveRecord's counting. Override if you need a different counting method
758
763
  def count_records(records)
759
- if Rails::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
764
+ if (Rails::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1) || Rails::VERSION::MAJOR >= 6
760
765
  records.count(:all)
761
766
  else
762
767
  records.count
@@ -790,7 +795,31 @@ module JSONAPI
790
795
  if table.blank? || field.to_s.include?('.')
791
796
  # :nocov:
792
797
  if quoted
793
- "\"#{field.to_s}\""
798
+ quote(field)
799
+ else
800
+ field.to_s
801
+ end
802
+ # :nocov:
803
+ else
804
+ if quoted
805
+ "#{quote(table)}.#{quote(field)}"
806
+ else
807
+ # :nocov:
808
+ "#{table.to_s}.#{field.to_s}"
809
+ # :nocov:
810
+ end
811
+ end
812
+ end
813
+
814
+ def sql_field_with_alias(table, field, quoted = true)
815
+ Arel.sql("#{concat_table_field(table, field, quoted)} AS #{alias_table_field(table, field, quoted)}")
816
+ end
817
+
818
+ def alias_table_field(table, field, quoted = false)
819
+ if table.blank? || field.to_s.include?('.')
820
+ # :nocov:
821
+ if quoted
822
+ quote(field)
794
823
  else
795
824
  field.to_s
796
825
  end
@@ -798,14 +827,19 @@ module JSONAPI
798
827
  else
799
828
  if quoted
800
829
  # :nocov:
801
- "\"#{table.to_s}\".\"#{field.to_s}\""
830
+ quote("#{table.to_s}_#{field.to_s}")
802
831
  # :nocov:
803
832
  else
804
- "#{table.to_s}.#{field.to_s}"
833
+ "#{table.to_s}_#{field.to_s}"
805
834
  end
806
835
  end
807
836
  end
808
837
 
838
+ def quote(field)
839
+ "\"#{field.to_s}\""
840
+ end
841
+
842
+
809
843
  def apply_filters(records, filters, options = {})
810
844
  if filters
811
845
  filters.each do |filter, value|
@@ -873,7 +873,7 @@ module JSONAPI
873
873
  if !_polymorphic
874
874
  ''
875
875
  else
876
- @_polymorphic_name ||= _model_name.to_s.downcase
876
+ @_polymorphic_name ||= _model_name.to_s.underscore
877
877
  end
878
878
  end
879
879
 
@@ -927,7 +927,7 @@ module JSONAPI
927
927
  next unless Module === klass
928
928
  if klass < ActiveRecord::Base
929
929
  klass.reflect_on_all_associations(:has_many).select{|r| r.options[:as] }.each do |reflection|
930
- (hash[reflection.options[:as]] ||= []) << klass.name.downcase
930
+ (hash[reflection.options[:as]] ||= []) << klass.name.underscore
931
931
  end
932
932
  end
933
933
  end
@@ -1058,7 +1058,7 @@ module JSONAPI
1058
1058
  end
1059
1059
 
1060
1060
  def construct_order_options(sort_params)
1061
- sort_params ||= default_sort
1061
+ sort_params = default_sort if sort_params.blank?
1062
1062
 
1063
1063
  return {} unless sort_params
1064
1064
 
@@ -51,8 +51,8 @@ module JSONAPI
51
51
  @fetchable_fields = Set.new(fetchable_fields)
52
52
 
53
53
  # Relationships left uncompiled because we'll often want to insert included ids on retrieval
54
- @relationships = relationships
55
-
54
+ # Remove the data since that should not be cached
55
+ @relationships = relationships&.transform_values {|v| v.delete_if {|k, _v| k == 'data'} }
56
56
  @links_json = CompiledJson.of(links_json)
57
57
  @attributes_json = CompiledJson.of(attributes_json)
58
58
  @meta_json = CompiledJson.of(meta_json)
@@ -18,7 +18,7 @@ module JSONAPI
18
18
  :default_paginator,
19
19
  :default_page_size,
20
20
  :maximum_page_size,
21
- :default_processor_klass,
21
+ :default_processor_klass_name,
22
22
  :use_text_errors,
23
23
  :top_level_links_include_pagination,
24
24
  :top_level_meta_include_record_count,
@@ -39,7 +39,8 @@ module JSONAPI
39
39
  :default_resource_cache_field,
40
40
  :resource_cache_digest_function,
41
41
  :resource_cache_usage_report_function,
42
- :default_exclude_links
42
+ :default_exclude_links,
43
+ :use_related_resource_records_for_joins
43
44
 
44
45
  def initialize
45
46
  #:underscored_key, :camelized_key, :dasherized_key, or custom
@@ -110,7 +111,7 @@ module JSONAPI
110
111
 
111
112
  # The default Operation Processor to use if one is not defined specifically
112
113
  # for a Resource.
113
- self.default_processor_klass = JSONAPI::Processor
114
+ self.default_processor_klass_name = 'JSONAPI::Processor'
114
115
 
115
116
  # Allows transactions for creating and updating records
116
117
  # Set this to false if your backend does not support transactions (e.g. Mongodb)
@@ -158,6 +159,11 @@ module JSONAPI
158
159
  # and relationships. Accepts either `:default`, `:none`, or array containing the
159
160
  # specific default links to exclude, which may be `:self` and `:related`.
160
161
  self.default_exclude_links = :none
162
+
163
+ # Use a related resource's `records` when performing joins. This setting allows included resources to account for
164
+ # permission scopes. It can be overridden explicitly per relationship. Furthermore, specifying a `relation_name`
165
+ # on a relationship will cause this setting to be ignored.
166
+ self.use_related_resource_records_for_joins = true
161
167
  end
162
168
 
163
169
  def cache_formatters=(bool)
@@ -225,9 +231,19 @@ module JSONAPI
225
231
  end
226
232
 
227
233
  def default_processor_klass=(default_processor_klass)
234
+ ActiveSupport::Deprecation.warn('`default_processor_klass` has been replaced by `default_processor_klass_name`.')
228
235
  @default_processor_klass = default_processor_klass
229
236
  end
230
237
 
238
+ def default_processor_klass
239
+ @default_processor_klass ||= default_processor_klass_name.safe_constantize
240
+ end
241
+
242
+ def default_processor_klass_name=(default_processor_klass_name)
243
+ @default_processor_klass = nil
244
+ @default_processor_klass_name = default_processor_klass_name
245
+ end
246
+
231
247
  def allow_include=(allow_include)
232
248
  ActiveSupport::Deprecation.warn('`allow_include` has been replaced by `default_allow_include_to_one` and `default_allow_include_to_many` options.')
233
249
  @default_allow_include_to_one = allow_include
@@ -289,6 +305,8 @@ module JSONAPI
289
305
  attr_writer :resource_cache_usage_report_function
290
306
 
291
307
  attr_writer :default_exclude_links
308
+
309
+ attr_writer :use_related_resource_records_for_joins
292
310
  end
293
311
 
294
312
  class << self
@@ -30,7 +30,7 @@ module JSONAPI
30
30
  end
31
31
 
32
32
  def eql?(other)
33
- relationship == other.relationship && resource_klass == other.resource_klass
33
+ other.is_a?(JSONAPI::PathSegment::Relationship) && relationship == other.relationship && resource_klass == other.resource_klass
34
34
  end
35
35
 
36
36
  def hash
@@ -59,7 +59,7 @@ module JSONAPI
59
59
  end
60
60
 
61
61
  def eql?(other)
62
- field_name == other.field_name && resource_klass == other.resource_klass
62
+ other.is_a?(JSONAPI::PathSegment::Field) && field_name == other.field_name && resource_klass == other.resource_klass
63
63
  end
64
64
 
65
65
  def delegated_field_name
@@ -392,7 +392,7 @@ module JSONAPI
392
392
  primary_resource_id_tree = PrimaryResourceIdTree.new
393
393
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
394
394
 
395
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
395
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
396
396
 
397
397
  primary_resource_id_tree
398
398
  end
@@ -406,7 +406,7 @@ module JSONAPI
406
406
  primary_resource_id_tree = PrimaryResourceIdTree.new
407
407
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
408
408
 
409
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
409
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
410
410
 
411
411
  primary_resource_id_tree
412
412
  end
@@ -422,7 +422,7 @@ module JSONAPI
422
422
  primary_resource_id_tree = PrimaryResourceIdTree.new
423
423
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
424
424
 
425
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
425
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
426
426
 
427
427
  primary_resource_id_tree
428
428
  end
@@ -434,7 +434,7 @@ module JSONAPI
434
434
  relationship = resource_klass._relationship(key)
435
435
  relationship_name = relationship.name.to_sym
436
436
 
437
- find_related_resource_options = options.dup
437
+ find_related_resource_options = options.except(:filters, :sort_criteria, :paginator)
438
438
  find_related_resource_options[:sort_criteria] = relationship.resource_klass.default_sort
439
439
  find_related_resource_options[:cache] = resource_klass.caching?
440
440
 
@@ -3,7 +3,7 @@ module JSONAPI
3
3
  attr_reader :acts_as_set, :foreign_key, :options, :name,
4
4
  :class_name, :polymorphic, :always_include_optional_linkage_data,
5
5
  :parent_resource, :eager_load_on_include, :custom_methods,
6
- :inverse_relationship, :allow_include
6
+ :inverse_relationship, :allow_include, :use_related_resource_records_for_joins
7
7
 
8
8
  attr_writer :allow_include
9
9
 
@@ -23,6 +23,15 @@ module JSONAPI
23
23
  @polymorphic_types ||= options[:polymorphic_relations]
24
24
  end
25
25
 
26
+ use_related_resource_records_for_joins_default = if options[:relation_name]
27
+ false
28
+ else
29
+ JSONAPI.configuration.use_related_resource_records_for_joins
30
+ end
31
+
32
+ @use_related_resource_records_for_joins = options.fetch(:use_related_resource_records_for_joins,
33
+ use_related_resource_records_for_joins_default) == true
34
+
26
35
  @always_include_optional_linkage_data = options.fetch(:always_include_optional_linkage_data, false) == true
27
36
  @eager_load_on_include = options.fetch(:eager_load_on_include, false) == true
28
37
  @allow_include = options[:allow_include]
@@ -63,7 +72,7 @@ module JSONAPI
63
72
  next unless Module === klass
64
73
  if ActiveRecord::Base > klass
65
74
  klass.reflect_on_all_associations(:has_many).select{|r| r.options[:as] }.each do |reflection|
66
- (hash[reflection.options[:as]] ||= []) << klass.name.downcase
75
+ (hash[reflection.options[:as]] ||= []) << klass.name.underscore
67
76
  end
68
77
  end
69
78
  end
@@ -418,7 +418,7 @@ module JSONAPI
418
418
  sorts = sort_criteria
419
419
  elsif sort_criteria.is_a?(String)
420
420
  begin
421
- raw = URI.unescape(sort_criteria)
421
+ raw = URI.decode_www_form_component(sort_criteria)
422
422
  sorts = CSV.parse_line(raw)
423
423
  rescue CSV::MalformedCSVError
424
424
  fail JSONAPI::Exceptions::InvalidSortCriteria.new(format_key(resource_klass._type), raw)
@@ -5,10 +5,10 @@ module JSONAPI
5
5
  ActionController::Rendering,
6
6
  ActionController::Renderers::All,
7
7
  ActionController::StrongParameters,
8
- ActionController::ForceSSL,
8
+ Gem::Requirement.new('< 6.1').satisfied_by?(ActionPack.gem_version) ? ActionController::ForceSSL : nil,
9
9
  ActionController::Instrumentation,
10
10
  JSONAPI::ActsAsResourceController
11
- ].freeze
11
+ ].compact.freeze
12
12
 
13
13
  # Note, the url_helpers are not loaded. This will prevent links from being generated for resources, and warnings
14
14
  # will be emitted. Link support can be added by including `Rails.application.routes.url_helpers`, and links
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = '0.10.2'
3
+ VERSION = '0.10.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,30 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
8
8
  - Larry Gebhardt
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-11 00:00:00.000000000 Z
12
+ date: 2022-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.17.3
20
+ version: '1.17'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 1.17.3
27
+ version: '1.17'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -232,7 +232,7 @@ homepage: https://github.com/cerebris/jsonapi-resources
232
232
  licenses:
233
233
  - MIT
234
234
  metadata: {}
235
- post_install_message:
235
+ post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
238
238
  - lib
@@ -247,8 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubygems_version: 3.0.3
251
- signing_key:
250
+ rubygems_version: 3.1.6
251
+ signing_key:
252
252
  specification_version: 4
253
253
  summary: Easily support JSON API in Rails.
254
254
  test_files: []