From 3750766f425f09439257cbe4934877a17bf815ea Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Tue, 21 Mar 2017 17:04:12 +0100 Subject: Escape route path for LIKE queries --- app/models/namespace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/namespace.rb') diff --git a/app/models/namespace.rb b/app/models/namespace.rb index d350f1d6770..826ded22ae5 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -195,7 +195,7 @@ class Namespace < ActiveRecord::Base # Scopes the model on direct and indirect children of the record def descendants - self.class.joins(:route).where('routes.path LIKE ?', "#{route.path}/%").reorder('routes.path ASC') + self.class.joins(:route).merge(Route.inside_path(route.path)).reorder('routes.path ASC') end def user_ids_for_project_authorizations -- cgit v1.2.1