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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
98b1f549
Commit
98b1f549
authored
Jul 06, 2018
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rails5] Fix milestone GROUP BY query
parent
d810e65a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
app/models/milestone.rb
app/models/milestone.rb
+2
-1
changelogs/unreleased/blackst0ne-rails5-activerecord-statementinvalid-mysql2-error-expression-1-of-select-list-is-not-in-group-by-clause.yml
...expression-1-of-select-list-is-not-in-group-by-clause.yml
+5
-0
No files found.
app/models/milestone.rb
View file @
98b1f549
...
@@ -131,9 +131,10 @@ class Milestone < ActiveRecord::Base
...
@@ -131,9 +131,10 @@ class Milestone < ActiveRecord::Base
rel
.
order
(
:project_id
,
:due_date
).
select
(
'DISTINCT ON (project_id) id'
)
rel
.
order
(
:project_id
,
:due_date
).
select
(
'DISTINCT ON (project_id) id'
)
else
else
rel
rel
.
group
(
:project_id
)
.
group
(
:project_id
,
:due_date
,
:id
)
.
having
(
'due_date = MIN(due_date)'
)
.
having
(
'due_date = MIN(due_date)'
)
.
pluck
(
:id
,
:project_id
,
:due_date
)
.
pluck
(
:id
,
:project_id
,
:due_date
)
.
uniq
(
&
:second
)
.
map
(
&
:first
)
.
map
(
&
:first
)
end
end
end
end
...
...
changelogs/unreleased/blackst0ne-rails5-activerecord-statementinvalid-mysql2-error-expression-1-of-select-list-is-not-in-group-by-clause.yml
0 → 100644
View file @
98b1f549
---
title
:
"
[Rails5]
Fix
milestone
GROUP
BY
query"
merge_request
:
20256
author
:
"
@blackst0ne"
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