active_hash_relation 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: e715e9a37b308b7349d0d842fdd7ce7df39b005a
4
- data.tar.gz: 54a6f94ae717a4acaa2f8dab2ad0481dd96fe0ab
3
+ metadata.gz: eb48b886a8ace57b0562d7e40bc60a10daf7fde3
4
+ data.tar.gz: 6576b638fc3f6c21e5a3abfaa3d6329c7be6f8cc
5
5
  SHA512:
6
- metadata.gz: f497e1de1028dfbd9cd5b2c10fd61cf772726edd8b6370570c43ba074bce7748e7f061ec52d29524ea50cb94f43bb2b6421e14ac1e1c56d298860a954f3cd366
7
- data.tar.gz: b764c826ccef44218ff0efc522e23815af586dc5c6e48090909bb9156ce510c9ab218083b39df34c4f38891fcb521631af731caf516ed39fbddacd45c121f891
6
+ metadata.gz: 626e25dd25e90c29a9360d986a8cfafa035ddc5822be42d38ada63ea61ab014b862f445db2ad68271cca1a2ecb2d8e519413a080b74bd2ecce8c12c772767bf9
7
+ data.tar.gz: 44c97841194c7df3b8e8bece218123b4f1e77db0edb42bd9d21a19269912e3f40c017734739271695f449166e8a63d5cb696b58166385f34bcc5d501b970815a
@@ -20,7 +20,12 @@ module ActiveHashRelation::ColumnFilters
20
20
  end
21
21
 
22
22
  def filter_string(resource, column, table_name, param)
23
- resource = resource.where("#{table_name}.#{column} ILIKE ?", "%#{param}%")
23
+ if param.is_a? Array
24
+ n_param = param.to_s.gsub("\"","'").gsub("[","").gsub("]","")
25
+ return resource = resource.where("#{table_name}.#{column} IN (#{n_param})")
26
+ else
27
+ return resource = resource.where("#{table_name}.#{column} ILIKE ?", "%#{param}%")
28
+ end
24
29
  end
25
30
 
26
31
  def filter_text(resource, column, param)
@@ -24,7 +24,8 @@ module ActiveHashRelation
24
24
  end
25
25
  table_name = @model.table_name
26
26
  @model.columns.each do |c|
27
- next if @params[c.name.to_s].blank?
27
+ next if @params[c.name.to_s].nil?
28
+ next if @params[c.name.to_s].is_a?(String) && @params[c.name.to_s].blank?
28
29
 
29
30
  if c.respond_to?(:primary)
30
31
  if c.primary
@@ -1,3 +1,3 @@
1
1
  module ActiveHashRelation
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_hash_relation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filippos Vasilakis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-06 00:00:00.000000000 Z
12
+ date: 2015-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler