iord 1.1.2 → 1.1.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: 4a17a58e4d8b6751f81ee92843bc38d42c30ad29
4
- data.tar.gz: 549e3fb34c70b38081c0a090bdb4ace00d180a85
3
+ metadata.gz: 04aa3eaa23568ae2494bc409c6f81cbe7d963674
4
+ data.tar.gz: f727e3d3463a89d46bb7079f152b3cf730bfab7e
5
5
  SHA512:
6
- metadata.gz: 87eeaf603ab5bfd87a2dcafed4595e2e9fa4d34188a908cf8268c92112e5b8153c677ab3a8530e4834e00cd0ab420b57d3154b8ccea065999301494f68eb8467
7
- data.tar.gz: b67289848b758c44ed88684fce632efcf5c23f1dfefc483c13d1a06292dbfa74871ff04247563d9950e64f3fb7c882cc82911f647fc43d96ba67cc7a9e492c34
6
+ metadata.gz: f9bd7a738300709dd221b697b0a4d8dd851134d35a312e39fd73f82ece2ee7c653a0afc30014936d99c42109f445af822d347c8eeb4eee66e748ec5e59261d87
7
+ data.tar.gz: 60f70065283f70626f45f074401e372098dcb3144275a0b2f609f18ec35974da9ed387763442c5a147a6461d0d46b8a254fd873f26b98802254b8dd370cd6e0e
data/lib/iord/search.rb CHANGED
@@ -75,6 +75,15 @@ module Iord
75
75
  return @search_term
76
76
  end
77
77
 
78
+ def term_type(klass, term)
79
+ term = term.split('.') if term.is_a?(String)
80
+ if term.count == 1
81
+ klass.fields[term[0]].type
82
+ else
83
+ term_type(klass.relations[term[0]].klass, term[1..-1])
84
+ end
85
+ end
86
+
78
87
  def search_value
79
88
  if @search_value.nil?
80
89
  return @search_value = nil if search_term.nil?
@@ -109,7 +118,8 @@ module Iord
109
118
  if search_value.empty?
110
119
  collection = collection.where(search_term.to_sym.in => [nil, ''])
111
120
  else
112
- collection = collection.where(search_term => search_value)
121
+ type = term_type(resource_class, search_term)
122
+ collection = collection.where(search_term => type.evolve(search_value))
113
123
  end
114
124
  else
115
125
  collection = collection.where(search_term => {"$#{search_operator}" => search_value})
data/lib/iord/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Iord
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffroy Planquart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails