Commit cb94f4a9 authored by jplang's avatar jplang
Browse files

Don't compare LOWER() with #downcase.

git-svn-id: e93f8b46-1217-0410-a6f0-8f06a7374b81
parent c366143b
......@@ -103,11 +103,9 @@ class Project < ActiveRecord::Base
where(Project.allowed_to_condition(user, permission, *args))
scope :like, lambda {|arg|
if arg.blank?
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)
scope :sorted, lambda {order(:lft)}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment