X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6f6f108d9d5bcb2e2a033bb16ac5dd78e108291f..0b1fb2bd766d117745188ea321de08c904711c49:/services/api/app/controllers/application_controller.rb diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb index 05d12427e6..34a22aa809 100644 --- a/services/api/app/controllers/application_controller.rb +++ b/services/api/app/controllers/application_controller.rb @@ -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} like ?" + 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