##// END OF EJS Templates
Replaces find(:all) calls....
Jean-Philippe Lang -
r10693:5cb56fd1e423
parent child
Show More
@@ -87,10 +87,7 module Redmine
87 token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
87 token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
88
88
89 if !options[:titles_only] && searchable_options[:search_custom_fields]
89 if !options[:titles_only] && searchable_options[:search_custom_fields]
90 searchable_custom_field_ids = CustomField.find(:all,
90 searchable_custom_field_ids = CustomField.where(:type => "#{self.name}CustomField", :searchable => true).pluck(:id)
91 :select => 'id',
92 :conditions => { :type => "#{self.name}CustomField",
93 :searchable => true }).collect(&:id)
94 if searchable_custom_field_ids.any?
91 if searchable_custom_field_ids.any?
95 custom_field_sql = "#{table_name}.id IN (SELECT customized_id FROM #{CustomValue.table_name}" +
92 custom_field_sql = "#{table_name}.id IN (SELECT customized_id FROM #{CustomValue.table_name}" +
96 " WHERE customized_type='#{self.name}' AND customized_id=#{table_name}.id AND LOWER(value) LIKE ?" +
93 " WHERE customized_type='#{self.name}' AND customized_id=#{table_name}.id AND LOWER(value) LIKE ?" +
General Comments 0
You need to be logged in to leave comments. Login now