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 +4 -4
- data/lib/iord/search.rb +11 -1
- data/lib/iord/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04aa3eaa23568ae2494bc409c6f81cbe7d963674
|
4
|
+
data.tar.gz: f727e3d3463a89d46bb7079f152b3cf730bfab7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
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.
|
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-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|