Browse Source

Don't compare LOWER() with #downcase.

git-svn-id: http://svn.redmine.org/redmine/trunk@16480 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
d8dec34ece
1 changed files with 3 additions and 5 deletions
  1. 3
    5
      app/models/project.rb

+ 3
- 5
app/models/project.rb View File

@@ -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)}

Loading…
Cancel
Save