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
04d2d8f9
Commit
04d2d8f9
authored
Jun 27, 2019
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move order lambda to list scope
- apply ordering to both list scopes in `Board`
parent
82b87ae5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
app/models/board.rb
app/models/board.rb
+2
-2
app/models/list.rb
app/models/list.rb
+1
-0
No files found.
app/models/board.rb
View file @
04d2d8f9
...
...
@@ -4,8 +4,8 @@ class Board < ApplicationRecord
belongs_to
:group
belongs_to
:project
has_many
:lists
,
->
{
order
(
:list_type
,
:position
)
},
dependent: :delete_all
# rubocop:disable Cop/ActiveRecordDependent
has_many
:destroyable_lists
,
->
{
lists
.
destroyable
},
class_name:
"List"
has_many
:lists
,
->
{
order
ed
},
dependent: :delete_all
# rubocop:disable Cop/ActiveRecordDependent
has_many
:destroyable_lists
,
->
{
destroyable
.
ordered
},
class_name:
"List"
validates
:project
,
presence:
true
,
if: :project_needed?
validates
:group
,
presence:
true
,
unless: :project
...
...
app/models/list.rb
View file @
04d2d8f9
...
...
@@ -16,6 +16,7 @@ class List < ApplicationRecord
scope
:destroyable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
destroyable_types
).
values
)
}
scope
:movable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
movable_types
).
values
)
}
scope
:preload_associations
,
->
{
preload
(
:board
,
:label
)
}
scope
:ordered
,
->
{
order
(
:list_type
,
:position
)
}
class
<<
self
def
destroyable_types
...
...
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