Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10920 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
282a13d6ee
commit
5cb56fd1e4
|
@ -87,10 +87,7 @@ module Redmine
|
||||||
token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
|
token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
|
||||||
|
|
||||||
if !options[:titles_only] && searchable_options[:search_custom_fields]
|
if !options[:titles_only] && searchable_options[:search_custom_fields]
|
||||||
searchable_custom_field_ids = CustomField.find(:all,
|
searchable_custom_field_ids = CustomField.where(:type => "#{self.name}CustomField", :searchable => true).pluck(:id)
|
||||||
:select => 'id',
|
|
||||||
:conditions => { :type => "#{self.name}CustomField",
|
|
||||||
:searchable => true }).collect(&:id)
|
|
||||||
if searchable_custom_field_ids.any?
|
if searchable_custom_field_ids.any?
|
||||||
custom_field_sql = "#{table_name}.id IN (SELECT customized_id FROM #{CustomValue.table_name}" +
|
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 ?" +
|
" WHERE customized_type='#{self.name}' AND customized_id=#{table_name}.id AND LOWER(value) LIKE ?" +
|
||||||
|
|
Loading…
Reference in New Issue