rest_framework 0.7.10 → 0.7.11

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: 71c34ceb6bb68b3b9ea023e62fa2fc5d6ea3382fad38a94d32c235d66fe87281
4
- data.tar.gz: d4300ef78a151d25f0d67b74df5d1d6584e0452e3ff3e719ddae41ece6aa3cf7
3
+ metadata.gz: 7bd88c76d9f83658ca09087b8931cec7ea569b4df5675c4ae8e21045dedf8ab2
4
+ data.tar.gz: 72d0a0a1f8bc086fbd69713d825ed0aedc93540ab1d114d0843cb5e99aca6696
5
5
  SHA512:
6
- metadata.gz: ce6946077715c32b8e7f5d08c8df1b1d1ae9f7b714c5ed8411a4086ba5fe8a96328179fdf7685c26b7fce7d8d208dba1045d499952b4980c0a3cfac71364cc07
7
- data.tar.gz: a4da9fd65a971ddad1e596927d95ff7088fbd6429df007941ef2c990ab08df19d8891abb22166a5cc13ae155438cfc04aa63868060ea4f2c647023a707f45a71
6
+ metadata.gz: b58f0e75004fc57e10366ecdd681a1729c88280514a71023585a49690ded6ee3a7947c9271f212b012412581ac62e3d294a2d955eda833e8b5dcce71bb0410ca
7
+ data.tar.gz: 20022bf8d6171d37f118693ccc50e419a885a17e7d8455833b3399387cbeb534c3e19834110b797aca0066f40d6fba0bf765b0aee4644b4a55b75ed4fa7cf9d4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.10
1
+ 0.7.11
@@ -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.
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.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory N. Schmit
8
- autorequire:
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
@@ -62,7 +62,7 @@ licenses:
62
62
  metadata:
63
63
  homepage_uri: https://rails-rest-framework.com
64
64
  source_code_uri: https://github.com/gregschmit/rails-rest-framework
65
- post_install_message:
65
+ post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
68
68
  - lib
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubygems_version: 3.2.33
82
- signing_key:
82
+ signing_key:
83
83
  specification_version: 4
84
84
  summary: A framework for DRY RESTful APIs in Ruby on Rails.
85
85
  test_files: []