Commit 4e8450af authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'force-reload-arguments-2' into 'master'

Passing an argument to force an association to reload is now deprecated

See merge request gitlab-org/gitlab-ce!23894
parents c5a13265 0d1922dd
...@@ -48,8 +48,8 @@ class MergeRequest < ActiveRecord::Base ...@@ -48,8 +48,8 @@ class MergeRequest < ActiveRecord::Base
# is the inverse of MergeRequest#merge_request_diff, which means it may not be # 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 # 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. # MR. If we haven't already loaded a diff, then it's fine to load the latest.
def merge_request_diff(*args) def merge_request_diff
fallback = latest_merge_request_diff if args.empty? && !association(:merge_request_diff).loaded? fallback = latest_merge_request_diff unless association(:merge_request_diff).loaded?
fallback || super fallback || super
end end
...@@ -620,10 +620,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -620,10 +620,6 @@ class MergeRequest < ActiveRecord::Base
end end
end end
def reload_merge_request_diff
merge_request_diff(true)
end
def viewable_diffs def viewable_diffs
@viewable_diffs ||= merge_request_diffs.viewable.to_a @viewable_diffs ||= merge_request_diffs.viewable.to_a
end end
......
---
title: Passing an argument to force an association to reload is now deprecated
merge_request: 23894
author: Jasper Maes
type: other
...@@ -2092,7 +2092,7 @@ describe MergeRequest do ...@@ -2092,7 +2092,7 @@ describe MergeRequest do
head_commit_sha: commit.sha head_commit_sha: commit.sha
) )
subject.merge_request_diff(true) subject.reload_merge_request_diff
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment