From 5cb56fd1e4230dd8a199adab98565b9dc3bb9596 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 2 Dec 2012 20:42:58 +0000 Subject: [PATCH] Replaces find(:all) calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10920 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb index ff9d2d507..fe0f8518e 100644 --- a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb +++ b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb @@ -87,10 +87,7 @@ module Redmine token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"} if !options[:titles_only] && searchable_options[:search_custom_fields] - searchable_custom_field_ids = CustomField.find(:all, - :select => 'id', - :conditions => { :type => "#{self.name}CustomField", - :searchable => true }).collect(&:id) + searchable_custom_field_ids = CustomField.where(:type => "#{self.name}CustomField", :searchable => true).pluck(:id) if searchable_custom_field_ids.any? custom_field_sql = "#{table_name}.id IN (SELECT customized_id FROM #{CustomValue.table_name}" + " WHERE customized_type='#{self.name}' AND customized_id=#{table_name}.id AND LOWER(value) LIKE ?" +