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
be68e0d3
Commit
be68e0d3
authored
Jul 05, 2018
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rails5 fix AttachmentRegistryFinder arel queries
parent
94d5adec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
ee/app/finders/geo/attachment_registry_finder.rb
ee/app/finders/geo/attachment_registry_finder.rb
+11
-4
ee/changelogs/unreleased/rails5-fix-6745.yml
ee/changelogs/unreleased/rails5-fix-6745.yml
+5
-0
No files found.
ee/app/finders/geo/attachment_registry_finder.rb
View file @
be68e0d3
...
...
@@ -103,16 +103,23 @@ module Geo
Namespace
.
none
end
arel_namespace_ids
=
Arel
::
Nodes
::
SqlLiteral
.
new
(
namespace_ids
.
to_sql
)
# This query was intentionally converted to a raw one to get it work in Rails 5.0.
# In Rails 5.0 and 5.1 there's a bug: https://github.com/rails/arel/issues/531
# Please convert it back when on rails 5.2 as it works again as expected since 5.2.
namespace_ids_in_sql
=
Arel
::
Nodes
::
SqlLiteral
.
new
(
"uploads.model_id IN (
#{
namespace_ids
.
to_sql
}
)"
)
upload_table
[
:model_type
].
eq
(
'Namespace'
).
and
(
upload_table
[
:model_id
].
in
(
arel_namespace_ids
)
)
upload_table
[
:model_type
].
eq
(
'Namespace'
).
and
(
namespace_ids_in_sql
)
end
def
project_uploads
project_ids
=
current_node
.
projects
.
select
(
:id
)
arel_project_ids
=
Arel
::
Nodes
::
SqlLiteral
.
new
(
project_ids
.
to_sql
)
upload_table
[
:model_type
].
eq
(
'Project'
).
and
(
upload_table
[
:model_id
].
in
(
arel_project_ids
))
# This query was intentionally converted to a raw one to get it work in Rails 5.0.
# In Rails 5.0 and 5.1 there's a bug: https://github.com/rails/arel/issues/531
# Please convert it back when on rails 5.2 as it works again as expected since 5.2.
project_ids_in_sql
=
Arel
::
Nodes
::
SqlLiteral
.
new
(
"uploads.model_id IN (
#{
project_ids
.
to_sql
}
)"
)
upload_table
[
:model_type
].
eq
(
'Project'
).
and
(
project_ids_in_sql
)
end
def
other_uploads
...
...
ee/changelogs/unreleased/rails5-fix-6745.yml
0 → 100644
View file @
be68e0d3
---
title
:
Rails5 fix AttachmentRegistryFinder arel queries
merge_request
:
6396
author
:
Jasper Maes
type
:
fixed
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