rest_framework 0.8.9 → 0.8.10

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: 638d5d849cf0f6a3b456c7fc6d1906263df776333bc754f38553aa45162a7be3
4
- data.tar.gz: 87bb5dcd4f65d3539d60bd80103be7d4dbafbf3f90c29200dadd144743edd19f
3
+ metadata.gz: 213a37736ca78073859451dcc69b9dc7b17210087cb4250b454812c6de7c1a7c
4
+ data.tar.gz: 5392170651a45a187730ad8bf1355226569644c2732ef78c0919e778a927f323
5
5
  SHA512:
6
- metadata.gz: e784ebdc889cf8c89e6fce1916e001d30c3a160b7093e5ff2de4903de1b86a577794dace867353d22d63d7caa4992e4e2ae95c1e4daf515395303eb032e84500
7
- data.tar.gz: e1eb1f492d928d9c062676f72621b753fbdbf1fbe22ca3b04c920808ed51b82f1dd96859852fcce0c202f7d3276079ccc96524cbfcf76e897aff030563f16be9
6
+ metadata.gz: b00876f3c2ca1fdb6beeb290c38774b13fe0b1549d19f00084537f0e8b42c43b6d716f79a3a60835172b59479756b3c9ffd6c17895be6be4fd16ebf3296c4f8c
7
+ data.tar.gz: f24eaf37f5da6a5abf340e63d1a3cd9514b5f4bc610563c27040b14a9b2698a8110955a1bb7ce58f6f52df23e632408e4c4194d37a84c8f385f4bc9facbf395d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.9
1
+ 0.8.10
@@ -113,7 +113,11 @@ module RESTFramework::BaseModelControllerMixin
113
113
 
114
114
  # Get a field's config, including defaults.
115
115
  def get_field_config(f)
116
- config = self.field_config&.dig(f.to_sym) || {}
116
+ f = f.to_sym
117
+ @_get_field_config ||= {}
118
+ return @_get_field_config[f] if @_get_field_config[f]
119
+
120
+ config = self.field_config&.dig(f) || {}
117
121
 
118
122
  # Default sub-fields if field is an association.
119
123
  if ref = self.get_model.reflections[f.to_s]
@@ -137,7 +141,7 @@ module RESTFramework::BaseModelControllerMixin
137
141
  }.to_h.compact.presence
138
142
  end
139
143
 
140
- return config.compact
144
+ return @_get_field_config[f] = config.compact
141
145
  end
142
146
 
143
147
  # Get metadata about the resource's fields.
@@ -220,12 +220,15 @@ class RESTFramework::NativeSerializer < RESTFramework::BaseSerializer
220
220
  methods = []
221
221
  serializer_methods = {}
222
222
  fields.each do |f|
223
+ field_config = @controller.class.get_field_config(f)
224
+ next if field_config[:write_only]
225
+
223
226
  if f.in?(@model.column_names)
224
227
  columns << f
225
228
  elsif ref = @model.reflections[f]
226
229
  sub_columns = []
227
230
  sub_methods = []
228
- @controller.class.get_field_config(f)[:sub_fields].each do |sf|
231
+ field_config[:sub_fields].each do |sf|
229
232
  if !ref.polymorphic? && sf.in?(ref.klass.column_names)
230
233
  sub_columns << sf
231
234
  else
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.8.9
4
+ version: 0.8.10
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-02-27 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails