rest_framework 0.3.3 → 0.3.4
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 +1 -1
- data/lib/rest_framework/filters.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1583903193d7a8c88b82eea0f34b7bd65ad4c59cc4f1112c082dc1be0c88100f
|
4
|
+
data.tar.gz: 0b6fd3b17bb8255069af4f4b747c68b05c58cc07baa9a924f93284f1eba93528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc14438bd01e40cc8d971743ec1fbc1c39f3acc5d571fb218d819c293e01c6d2f9ccf4a5665ea34986e47a343c42ed065ac114cdcbcac9aafff2d9e86ec30033
|
7
|
+
data.tar.gz: 94b67818844fb8d2e4ca414f431ff85e7276216d1844f9da8413a1c135391fec26d6885c6fafc672c7068a579ec6d12ffd9f148d450ed8a0857820141f793966
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
@@ -40,7 +40,7 @@ module RESTFramework::BaseModelControllerMixin
|
|
40
40
|
ordering_no_reorder: false,
|
41
41
|
search_fields: nil,
|
42
42
|
search_query_param: 'search',
|
43
|
-
|
43
|
+
search_ilike: false,
|
44
44
|
|
45
45
|
# Other misc attributes.
|
46
46
|
create_from_recordset: true, # Option for `recordset.create` vs `Model.create` behavior.
|
@@ -84,7 +84,7 @@ class RESTFramework::ModelSearchFilter < RESTFramework::BaseFilter
|
|
84
84
|
# Ensure we use array conditions to prevent SQL injection.
|
85
85
|
unless search.blank?
|
86
86
|
return data.where(fields.map { |f|
|
87
|
-
"CAST(#{f} AS text) #{@controller.send(:
|
87
|
+
"CAST(#{f} AS text) #{@controller.send(:search_ilike) ? "ILIKE" : "LIKE"} ?"
|
88
88
|
}.join(' OR '), *(["%#{search}%"] * fields.length))
|
89
89
|
end
|
90
90
|
|