grape-listing 2.0.0.pre.beta.2 → 2.0.0.pre.beta.4
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 +4 -4
- data/lib/grape_listing/version.rb +1 -1
- data/lib/listing_service/search.rb +7 -7
- data/lib/listing_service/sorting.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: ad235bb148c378a4de82efee7fd0bec721702eaa88410c4ae9169cd627e49269
|
4
|
+
data.tar.gz: a4527257218d09dd016170a761784e4f43581121c07be843350dba0a01da143f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7caf71761d95963a2dd16dea5b476b1659d047a0153552b2188c690b6439e97336a5353af9b9a6a5fd07a54ebf25c8c006ad04bcec03784f40181c50a8a8d03
|
7
|
+
data.tar.gz: ba501abb3d5d1375755543bb1bf15e1293df080d8db99fc3045994f498ec0dc4a380f44c262a9f6b0b7845a43acc097986c71008bf3fdb887ea42fcd85707223
|
@@ -30,7 +30,7 @@ module GrapeListing
|
|
30
30
|
next unless [column, condition, operator].all?
|
31
31
|
|
32
32
|
# применение кастомного скоупа (при наличии)
|
33
|
-
custom_scope = @custom_search[column]
|
33
|
+
custom_scope = @custom_search[column] if @custom_search
|
34
34
|
if custom_scope
|
35
35
|
@objects = list.send(custom_scope, value)
|
36
36
|
next
|
@@ -132,9 +132,9 @@ module GrapeListing
|
|
132
132
|
def string_contain(subject, condition, value)
|
133
133
|
case condition
|
134
134
|
when IS
|
135
|
-
"#{subject} ILIKE %#{value}%"
|
135
|
+
"#{subject} ILIKE '%#{value}%'"
|
136
136
|
when NOT
|
137
|
-
"#{subject} NOT ILIKE %#{value}%"
|
137
|
+
"#{subject} NOT ILIKE '%#{value}%'"
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -150,18 +150,18 @@ module GrapeListing
|
|
150
150
|
def string_start(subject, condition, value)
|
151
151
|
case condition
|
152
152
|
when IS
|
153
|
-
"#{subject} ILIKE #{value}%"
|
153
|
+
"#{subject} ILIKE '#{value}%'"
|
154
154
|
when NOT
|
155
|
-
"#{subject} NOT ILIKE #{value}%"
|
155
|
+
"#{subject} NOT ILIKE '#{value}%'"
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
159
|
def string_end(subject, condition, value)
|
160
160
|
case condition
|
161
161
|
when IS
|
162
|
-
"#{subject} ILIKE %#{value}"
|
162
|
+
"#{subject} ILIKE '%#{value}'"
|
163
163
|
when NOT
|
164
|
-
"#{subject} NOT ILIKE %#{value}"
|
164
|
+
"#{subject} NOT ILIKE '%#{value}'"
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -6,7 +6,7 @@ module GrapeListing
|
|
6
6
|
def sort_proc
|
7
7
|
@sort_by = @params['sort_by'] || 'id'
|
8
8
|
@sort_order = @params['sort_order'] || 'desc'
|
9
|
-
custom_scope = @custom_sort[@sort_by]
|
9
|
+
custom_scope = @custom_sort[@sort_by] if @custom_sort
|
10
10
|
|
11
11
|
if custom_scope
|
12
12
|
proc { send(custom_scope, @sort_order) }
|