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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d7ddb2edcb994044872c61a3c15c2ae58394f620b19d4486b833ae7f5f57e7d
4
- data.tar.gz: 4bb801340d2f4f73af813e50008f002518ff3826bc67a30b81c9a46a4690b1c2
3
+ metadata.gz: ad235bb148c378a4de82efee7fd0bec721702eaa88410c4ae9169cd627e49269
4
+ data.tar.gz: a4527257218d09dd016170a761784e4f43581121c07be843350dba0a01da143f
5
5
  SHA512:
6
- metadata.gz: 1953a65f504b4911a82ae5f3520ea3100dd4b3c1aff9e28e17eecdc03bf6d26e34a0e505a5c70499ffd0e4d246348ea5cedb432176252e95e36016072ba2b639
7
- data.tar.gz: dc1de49e752f69467e502c34ef2531f9f583115c2563f675cca0f995202bd2f42945ad1a4aa9443b646f4e5c94b14ceb05263397b7013fc8a40c3e7766ff6300
6
+ metadata.gz: a7caf71761d95963a2dd16dea5b476b1659d047a0153552b2188c690b6439e97336a5353af9b9a6a5fd07a54ebf25c8c006ad04bcec03784f40181c50a8a8d03
7
+ data.tar.gz: ba501abb3d5d1375755543bb1bf15e1293df080d8db99fc3045994f498ec0dc4a380f44c262a9f6b0b7845a43acc097986c71008bf3fdb887ea42fcd85707223
@@ -1,3 +1,3 @@
1
1
  module GrapeListing
2
- VERSION = '2.0.0-beta.2'.freeze
2
+ VERSION = '2.0.0-beta.4'.freeze
3
3
  end
@@ -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) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-listing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.beta.2
4
+ version: 2.0.0.pre.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Павел Бабин