Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3e178326
Commit
3e178326
authored
Jul 31, 2019
by
Jason Goodman
Committed by
Bob Van Landuyt
Jul 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Deprecation Warning in has_environment_scope
parent
f0830bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
ee/app/models/concerns/has_environment_scope.rb
ee/app/models/concerns/has_environment_scope.rb
+4
-9
No files found.
ee/app/models/concerns/has_environment_scope.rb
View file @
3e178326
...
...
@@ -33,8 +33,8 @@ module HasEnvironmentScope
order
=
<<~
SQL
CASE environment_scope
WHEN
%{wildcard}
THEN 0
WHEN
%{environment_name}
THEN 2
WHEN
:wildcard
THEN 0
WHEN
:environment_name
THEN 2
ELSE 1
END
#{
order_direction
}
SQL
...
...
@@ -44,12 +44,7 @@ module HasEnvironmentScope
environment_name:
environment_name
}
quoted_values
=
values
.
transform_values
do
|
value
|
# Note that the connection could be
# Gitlab::Database::LoadBalancing::ConnectionProxy
# which supports `quote` via `method_missing`
ApplicationRecord
.
connection
.
quote
(
value
)
end
sanitized_order_sql
=
sanitize_sql_array
([
order
,
values
])
# The query is trying to find variables with scopes matching the
# current environment name. Suppose the environment name is
...
...
@@ -69,7 +64,7 @@ module HasEnvironmentScope
# the exact matched name, and put * last, and everything else in the
# middle. So the order should be: D < C < B
relation
=
where
(
where
,
values
)
.
order
(
order
%
quoted_values
)
# `order` cannot escape for us!
.
order
(
Arel
.
sql
(
sanitized_order_sql
)
)
# `order` cannot escape for us!
relation
=
relation
.
limit
(
1
)
if
relevant_only
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment