rest_framework 0.7.10 → 0.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71c34ceb6bb68b3b9ea023e62fa2fc5d6ea3382fad38a94d32c235d66fe87281
4
- data.tar.gz: d4300ef78a151d25f0d67b74df5d1d6584e0452e3ff3e719ddae41ece6aa3cf7
3
+ metadata.gz: e90565beac30b0b1889e0c0e710245e43a9fb4fa4a8a92d94a5672e5e4c0217a
4
+ data.tar.gz: 14c3b64dcea2f5337c53ac4e8ddd5ba84465363b8c36c8b65369ea6ac5b85925
5
5
  SHA512:
6
- metadata.gz: ce6946077715c32b8e7f5d08c8df1b1d1ae9f7b714c5ed8411a4086ba5fe8a96328179fdf7685c26b7fce7d8d208dba1045d499952b4980c0a3cfac71364cc07
7
- data.tar.gz: a4da9fd65a971ddad1e596927d95ff7088fbd6429df007941ef2c990ab08df19d8891abb22166a5cc13ae155438cfc04aa63868060ea4f2c647023a707f45a71
6
+ metadata.gz: 9d8a980559e4cc47ec38be083dfc2d4937635745813fd986f21f75ac61d8a75eaba23fd320c11dedd15fe891ab1e4c36558ffeeabb10288d89ea020378a231c4
7
+ data.tar.gz: 9c0f40e10da3444b08dde1e1a20f4ab618ba2da71729edd4190960dc6d9c695dd0e8d908a57aeb7114cef9bbaf0d0991e1848de2c196f1d49482e5de847e5e97
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.10
1
+ 0.7.12
@@ -50,6 +50,7 @@ module RESTFramework::BaseModelControllerMixin
50
50
  # Options for association assignment.
51
51
  permit_id_assignment: true,
52
52
  permit_nested_attributes_assignment: true,
53
+ allow_all_nested_attributes: false,
53
54
 
54
55
  # Option for `recordset.create` vs `Model.create` behavior.
55
56
  create_from_recordset: true,
@@ -386,19 +387,19 @@ module RESTFramework::BaseModelControllerMixin
386
387
  # Get a list of parameters allowed for the current action. By default we do not fallback to
387
388
  # columns so arbitrary fields can be submitted if no fields are defined.
388
389
  def get_allowed_parameters
389
- return @allowed_parameters if defined?(@allowed_parameters)
390
+ return @_get_allowed_parameters if defined?(@_get_allowed_parameters)
390
391
 
391
- @allowed_parameters = self._get_specific_action_config(
392
+ @_get_allowed_parameters = self._get_specific_action_config(
392
393
  :allowed_action_parameters,
393
394
  :allowed_parameters,
394
395
  )
395
- return @allowed_parameters if @allowed_parameters
396
- return @allowed_parameters = nil unless fields = self.get_fields
396
+ return @_get_allowed_parameters if @_get_allowed_parameters
397
+ return @_get_allowed_parameters = nil unless fields = self.get_fields
397
398
 
398
399
  # For fields, automatically add `_id`/`_ids` and `_attributes` variations for associations.
399
400
  id_variations = []
400
401
  variations = {}
401
- @allowed_parameters = fields.map { |f|
402
+ @_get_allowed_parameters = fields.map { |f|
402
403
  f = f.to_s
403
404
  next f unless ref = self.class.get_model.reflections[f]
404
405
 
@@ -411,14 +412,18 @@ module RESTFramework::BaseModelControllerMixin
411
412
  end
412
413
 
413
414
  if self.class.permit_nested_attributes_assignment
414
- variations["#{f}_attributes"] = self.class.get_field_config(f)[:sub_fields] || {}
415
+ if self.class.allow_all_nested_attributes
416
+ variations["#{f}_attributes"] = {}
417
+ else
418
+ variations["#{f}_attributes"] = self.class.get_field_config(f)[:sub_fields]
419
+ end
415
420
  end
416
421
 
417
422
  next f
418
423
  }.flatten
419
- @allowed_parameters += id_variations
420
- @allowed_parameters << variations
421
- return @allowed_parameters
424
+ @_get_allowed_parameters += id_variations
425
+ @_get_allowed_parameters << variations
426
+ return @_get_allowed_parameters
422
427
  end
423
428
 
424
429
  # Get the configured serializer class, or `NativeSerializer` as a default.
@@ -1,2 +1,2 @@
1
- class RESTFramework::Engine < ::Rails::Engine
1
+ class RESTFramework::Engine < Rails::Engine
2
2
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.10
4
+ version: 0.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory N. Schmit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-20 00:00:00.000000000 Z
11
+ date: 2023-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails