rest_framework 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/controller_mixins/models.rb +6 -0
- data/lib/rest_framework/filters.rb +1 -3
- 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: 057373b968952b2e2994e96e73617371a1ee8bb1f1169baa674df23de6009d77
|
4
|
+
data.tar.gz: d7773ccff492ddfcd89696502d82a041aafef09d4fbaca3188b73e4faeb00d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8d2da4e111a9424a439dda5b3a997947981cf5895d56790d325d3c9b8afe70b53fd57a9f550fb5978081df3fec4ab7f047afacd5de52d93fe199a2b7ff3494
|
7
|
+
data.tar.gz: 19b9c83fd9846aa1f445eadc36943875b4fa96ec7648ec7ffbaa07d08ff7c5a9b370ca8c4ab3ccaab17ad83a611a1105ee3fefacc635c7fc3eba398d94fe4651
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.7
|
@@ -207,6 +207,12 @@ module RESTFramework::BaseModelControllerMixin
|
|
207
207
|
# Get enum variants.
|
208
208
|
if type.is_a?(ActiveRecord::Enum::EnumType)
|
209
209
|
metadata[:enum_variants] = type.send(:mapping)
|
210
|
+
|
211
|
+
# Custom integration with `translate_enum`.
|
212
|
+
translate_method = "translated_#{f.pluralize}"
|
213
|
+
if model.respond_to?(translate_method)
|
214
|
+
metadata[:enum_translations] = model.send(translate_method)
|
215
|
+
end
|
210
216
|
end
|
211
217
|
end
|
212
218
|
end
|
@@ -115,8 +115,6 @@ end
|
|
115
115
|
|
116
116
|
# Multi-field text searching on models.
|
117
117
|
class RESTFramework::ModelSearchFilter < RESTFramework::BaseFilter
|
118
|
-
DEFAULT_SEARCH_COLUMNS = %w[name email title description note]
|
119
|
-
|
120
118
|
# Get a list of search fields for the current action. Fallback to columns but only grab a few
|
121
119
|
# common string-like columns by default.
|
122
120
|
def _get_fields
|
@@ -126,7 +124,7 @@ class RESTFramework::ModelSearchFilter < RESTFramework::BaseFilter
|
|
126
124
|
|
127
125
|
columns = @controller.class.get_model.columns_hash.keys
|
128
126
|
return @controller.get_fields(fallback: true).select { |f|
|
129
|
-
f.in?(
|
127
|
+
f.in?(RESTFramework.config.search_columns) && f.in?(columns)
|
130
128
|
}
|
131
129
|
end
|
132
130
|
|
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.
|
4
|
+
version: 0.8.7
|
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-
|
11
|
+
date: 2023-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|