Merge branch '1977-provenance-report' of git.clinicalfuture.com:arvados into 1977...
authorPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 4 Feb 2014 15:25:40 +0000 (10:25 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 4 Feb 2014 15:25:40 +0000 (10:25 -0500)
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

services/api/app/controllers/application_controller.rb

index 05d12427e6f6729c52dd59316f0c7a86c3cd1fb6..f43ab6adeca9e88230cae54d7d86bea2dc26f264 100644 (file)
@@ -125,6 +125,7 @@ class ApplicationController < ActionController::Base
       @where.each do |attr,value|
         if attr == :any
           if value.is_a?(Array) and
+              value.length == 2 and
               value[0] == 'contains' and
               model_class.columns.collect(&:name).index('name') then
             ilikes = []
@@ -142,8 +143,13 @@ class ApplicationController < ActionController::Base
             conditions[0] << " and #{table_name}.#{attr} is ?"
             conditions << nil
           elsif value.is_a? Array
-            conditions[0] << " and #{table_name}.#{attr} in (?)"
-            conditions << value
+            if value[0] == 'contains' and value.length == 2
+              conditions[0] << "and #{table_name}.#{attr} ilike ?"
+              conditions << "%#{value[1]}%"
+            else
+              conditions[0] << " and #{table_name}.#{attr} in (?)"
+              conditions << value
+            end
           elsif value.is_a? String or value.is_a? Fixnum or value == true or value == false
             conditions[0] << " and #{table_name}.#{attr}=?"
             conditions << value