summaryrefslogtreecommitdiffstats
path: root/app/controllers/search_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-10 17:58:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-10 17:58:07 +0000
commit6d9490ddcc9c501d31a8b403146cd4ba6d8cc5b5 (patch)
treead4a6a8cbc3ec2dadf61886a67c19ffc66ec6710 /app/controllers/search_controller.rb
parentf58db70bdecdbfd0a0d81c0c452d58b88391f9f1 (diff)
downloadredmine-6d9490ddcc9c501d31a8b403146cd4ba6d8cc5b5.tar.gz
redmine-6d9490ddcc9c501d31a8b403146cd4ba6d8cc5b5.zip
Merged Rails 2.0 compatibility changes.
Compatibility with Rails 1.2 is preserved. git-svn-id: http://redmine.rubyforge.org/svn/trunk@975 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index ee4f863aa..69e1ee503 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -90,9 +90,10 @@ class SearchController < ApplicationController
end
else
operator = @all_words ? ' AND ' : ' OR '
- Project.with_scope(:find => {:conditions => Project.visible_by(User.current)}) do
- @results += Project.find(:all, :limit => limit, :conditions => [ (["(LOWER(name) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'projects'
- end
+ @results += Project.find(:all,
+ :limit => limit,
+ :conditions => [ (["(#{Project.visible_by(User.current)}) AND (LOWER(name) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort]
+ ) if @scope.include? 'projects'
# if only one project is found, user is redirected to its overview
redirect_to :controller => 'projects', :action => 'show', :id => @results.first and return if @results.size == 1
end