corn_starch 1.2.6 → 1.2.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8b861eef819c096245fbca543346ea27b8fbf37
|
4
|
+
data.tar.gz: abbb4acce59ab11524526314d5b10e2639f57226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a32619d2d2900f9751854bf5ee6f0b92328176f3cc32d97dd1370d12dde0bfdac1eed034415b03c2ad12eaf1ba40976ed7b7da15f701defac16111c364ed2b
|
7
|
+
data.tar.gz: 81181019157a421560fd22b68fa239388143d6b216fa8b5900dd88aa93773f4a877d2e7bf3bef2207e08596fd29a4b0e157b4b2b4951c62efcebfc791d8ce33a
|
@@ -111,6 +111,7 @@ module CornStarch
|
|
111
111
|
search_q = ''
|
112
112
|
search_a = []
|
113
113
|
search_fields = {}
|
114
|
+
first = true
|
114
115
|
|
115
116
|
# Run through Model's Associations
|
116
117
|
model.searchable_associations.each do |a|
|
@@ -129,23 +130,16 @@ module CornStarch
|
|
129
130
|
search_fields[model.table_name] = []
|
130
131
|
model.searchable_attributes.each { |a| search_fields[model.table_name] << a }
|
131
132
|
|
132
|
-
puts "======== SEARCH FIELDS ===== #{search_fields.inspect}"
|
133
|
-
|
134
133
|
# Run through Search Fields Models
|
135
134
|
search_fields.each do |m, fields|
|
136
135
|
|
137
|
-
# DEBUG
|
138
|
-
puts "==== MODEL - [ #{m.inspect} ]"
|
139
|
-
|
140
136
|
# Run through Model's Fields
|
141
137
|
fields.each do |f|
|
142
138
|
|
143
|
-
# DEBUG
|
144
|
-
puts "==== FIELD - [ #{f.inspect} ]"
|
145
|
-
|
146
139
|
# Build Search Query & Arguments Array
|
147
|
-
search_q = search_q + "#{m}.#{f} LIKE ? "
|
140
|
+
search_q = search_q + (first ? '' : 'OR ') + "#{m}.#{f} LIKE ? "
|
148
141
|
search_a << "%#{search}%"
|
142
|
+
first = false
|
149
143
|
end
|
150
144
|
end
|
151
145
|
|
data/lib/corn_starch/version.rb
CHANGED