From 250414c3539ecd31bbad0b6ae4f4cf94b2b1864e Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 14 May 2024 08:04:04 +0000 Subject: [PATCH] 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 --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index abac2a1f0..2b3280651 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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)} -- 2.39.5