Support
authorWard Vandewege <ward@clinicalfuture.com>
Tue, 5 Feb 2013 01:45:52 +0000 (20:45 -0500)
committerWard Vandewege <ward@clinicalfuture.com>
Tue, 5 Feb 2013 01:45:52 +0000 (20:45 -0500)
  where={"any":["contains","hu34"]}

style parameter. For now, 'any' just means a field called 'name'

app/controllers/application_controller.rb

index 738a07346b0008a86a8d77625e673977e88b8210..18d8735f8c0c3c960290df7d7e9e7eae42683a9a 100644 (file)
@@ -69,6 +69,11 @@ class ApplicationController < ActionController::Base
             conditions[0] << " and #{table_name}.#{attr}=?"
             conditions << value
           end
+        elsif (!value.nil? and attr == 'any' and
+          value.is_a?(Array) and value[0] == 'contains' and
+          model_class.columns.collect(&:name).index('name')) then
+            conditions[0] << " and #{table_name}.name ilike ?"
+            conditions << "%#{value[1]}%"
         end
       end
       if conditions.length > 1