From: Ward Vandewege Date: Tue, 5 Feb 2013 01:45:52 +0000 (-0500) Subject: Support X-Git-Tag: 1.1.0~3442 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/f5e82b2e78c7a764f47ad58f2d64f262fbd97c6a Support where={"any":["contains","hu34"]} style parameter. For now, 'any' just means a field called 'name' --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 738a07346b..18d8735f8c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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