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
Léo-Paul Géneau
gitlab-ce
Commits
0d1922dd
Commit
0d1922dd
authored
Nov 24, 2018
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Passing an argument to force an association to reload is now deprecated
parent
4a10c813
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
app/models/merge_request.rb
app/models/merge_request.rb
+2
-6
changelogs/unreleased/force-reload-arguments-2.yml
changelogs/unreleased/force-reload-arguments-2.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
No files found.
app/models/merge_request.rb
View file @
0d1922dd
...
...
@@ -48,8 +48,8 @@ class MergeRequest < ActiveRecord::Base
# is the inverse of MergeRequest#merge_request_diff, which means it may not be
# the latest diff, because we could have loaded any diff from this particular
# MR. If we haven't already loaded a diff, then it's fine to load the latest.
def
merge_request_diff
(
*
args
)
fallback
=
latest_merge_request_diff
if
args
.
empty?
&&
!
association
(
:merge_request_diff
).
loaded?
def
merge_request_diff
fallback
=
latest_merge_request_diff
unless
association
(
:merge_request_diff
).
loaded?
fallback
||
super
end
...
...
@@ -620,10 +620,6 @@ class MergeRequest < ActiveRecord::Base
end
end
def
reload_merge_request_diff
merge_request_diff
(
true
)
end
def
viewable_diffs
@viewable_diffs
||=
merge_request_diffs
.
viewable
.
to_a
end
...
...
changelogs/unreleased/force-reload-arguments-2.yml
0 → 100644
View file @
0d1922dd
---
title
:
Passing an argument to force an association to reload is now deprecated
merge_request
:
23894
author
:
Jasper Maes
type
:
other
spec/models/merge_request_spec.rb
View file @
0d1922dd
...
...
@@ -2092,7 +2092,7 @@ describe MergeRequest do
head_commit_sha:
commit
.
sha
)
subject
.
merge_request_diff
(
true
)
subject
.
reload_merge_request_diff
end
end
...
...
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