summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-04 17:53:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-04 17:53:48 +0000
commitd8dec34ece7463ab17c78c4c4ea16497780fd91e (patch)
treea6547d14dc73507a176cb2480cc6fb7d55f47032
parentf604fe946095350dccbb09a84962e94e10374d77 (diff)
downloadredmine-d8dec34ece7463ab17c78c4c4ea16497780fd91e.tar.gz
redmine-d8dec34ece7463ab17c78c4c4ea16497780fd91e.zip
Don't compare LOWER() with #downcase.
git-svn-id: http://svn.redmine.org/redmine/trunk@16480 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/project.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a425d8ca7..ce68c725c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -103,11 +103,9 @@ class Project < ActiveRecord::Base
where(Project.allowed_to_condition(user, permission, *args))
}
scope :like, lambda {|arg|
- if arg.blank?
- where(nil)
- else
- pattern = "%#{arg.to_s.strip.downcase}%"
- where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p", :p => pattern)
+ if arg.present?
+ pattern = "%#{arg.to_s.strip}%"
+ where("LOWER(identifier) LIKE LOWER(:p) OR LOWER(name) LIKE LOWER(:p)", :p => pattern)
end
}
scope :sorted, lambda {order(:lft)}