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 +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/controller_mixins/models.rb +14 -9
- data/lib/rest_framework/engine.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90565beac30b0b1889e0c0e710245e43a9fb4fa4a8a92d94a5672e5e4c0217a
|
4
|
+
data.tar.gz: 14c3b64dcea2f5337c53ac4e8ddd5ba84465363b8c36c8b65369ea6ac5b85925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d8a980559e4cc47ec38be083dfc2d4937635745813fd986f21f75ac61d8a75eaba23fd320c11dedd15fe891ab1e4c36558ffeeabb10288d89ea020378a231c4
|
7
|
+
data.tar.gz: 9c0f40e10da3444b08dde1e1a20f4ab618ba2da71729edd4190960dc6d9c695dd0e8d908a57aeb7114cef9bbaf0d0991e1848de2c196f1d49482e5de847e5e97
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
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 @
|
390
|
+
return @_get_allowed_parameters if defined?(@_get_allowed_parameters)
|
390
391
|
|
391
|
-
@
|
392
|
+
@_get_allowed_parameters = self._get_specific_action_config(
|
392
393
|
:allowed_action_parameters,
|
393
394
|
:allowed_parameters,
|
394
395
|
)
|
395
|
-
return @
|
396
|
-
return @
|
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
|
-
@
|
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
|
-
|
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
|
-
@
|
420
|
-
@
|
421
|
-
return @
|
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 <
|
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.
|
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-
|
11
|
+
date: 2023-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|