rest_framework 0.8.8 → 0.8.10

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: fdf558252b808d2206ef0998357d81ccab85d81da850e8d3fb6b881c8a6919b8
4
- data.tar.gz: 11bb1d4d4aeee303e691001694a9dc637b78f3f6b0a554f5945ee0ccd1ce0227
3
+ metadata.gz: 213a37736ca78073859451dcc69b9dc7b17210087cb4250b454812c6de7c1a7c
4
+ data.tar.gz: 5392170651a45a187730ad8bf1355226569644c2732ef78c0919e778a927f323
5
5
  SHA512:
6
- metadata.gz: a62aa886dac641f1635f41c8dfa659c3ddbc706d594ec3e58182241493b7294c58623be1aaa01010ec5f7473c6a64c887a582f1205ab560a1d05ddde00fe1a14
7
- data.tar.gz: e7e4f071815949810711be85bef6a5499f78fdf81f8cd872b7834e853f463313403f45877c0ae2f979eda23b6f33c55e768ce34941095e66ea3f4edbc0886d56
6
+ metadata.gz: b00876f3c2ca1fdb6beeb290c38774b13fe0b1549d19f00084537f0e8b42c43b6d716f79a3a60835172b59479756b3c9ffd6c17895be6be4fd16ebf3296c4f8c
7
+ data.tar.gz: f24eaf37f5da6a5abf340e63d1a3cd9514b5f4bc610563c27040b14a9b2698a8110955a1bb7ce58f6f52df23e632408e4c4194d37a84c8f385f4bc9facbf395d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.10
@@ -1,6 +1,6 @@
1
1
  <tr>
2
2
  <td>
3
- <% if route[:route].name && route[:verb] == "GET" && route[:matches_params] %>
3
+ <% if route[:verb] == "GET" && route[:matches_params] %>
4
4
  <%= link_to route[:relative_path], @route_props[:with_path_args].call(route[:route]) %>
5
5
  <% else %>
6
6
  <%= route[:relative_path] %>
@@ -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.8
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-16 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