Martin Edenhofer 11 лет назад
Родитель
Сommit
677f5c0e6e
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      app/models/application_model/search_index_base.rb

+ 8 - 4
app/models/application_model/search_index_base.rb

@@ -69,12 +69,16 @@ returns
 =end
 
   def search_index_data
-    data = []
+        puts 'aaaaa'
+
+    attributes = {}
     ['name', 'note'].each { |key|
-      data.push self[key] if self[key]
+      if self[key] && !self[key].empty?
+        attributes[key] = self[key]
+      end
     }
-    return data[0] if !data[1]
-    data
+    return if attributes.empty?
+    attributes
   end
 
   private