Browse Source

Explicitly reference table name in Project#like scope to avoid ambiguity (#40691).

Patch by Vincent Robert (@Nanego).


git-svn-id: https://svn.redmine.org/redmine/trunk@22830 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/131/merge
Go MAEDA 2 weeks ago
parent
commit
250414c353
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      app/models/project.rb

+ 1
- 1
app/models/project.rb View File

@@ -110,7 +110,7 @@ class Project < ApplicationRecord
scope :like, (lambda do |arg|
if arg.present?
pattern = "%#{sanitize_sql_like arg.to_s.strip}%"
where("LOWER(identifier) LIKE LOWER(:p) ESCAPE :s OR LOWER(name) LIKE LOWER(:p) ESCAPE :s", :p => pattern, :s => '\\')
where("LOWER(#{Project.table_name}.identifier) LIKE LOWER(:p) ESCAPE :s OR LOWER(#{Project.table_name}.name) LIKE LOWER(:p) ESCAPE :s", :p => pattern, :s => '\\')
end
end)
scope :sorted, lambda {order(:lft)}

Loading…
Cancel
Save