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

Rails 5 deprecation: Passing an argument to force an association to reload is now deprecated

See merge request gitlab-org/gitlab-ce!23337
This commit is contained in:
Robert Speicher 2018-11-26 21:15:00 +00:00
commit 7bbcd7b59b
2 changed files with 7 additions and 1 deletions

View File

@ -313,7 +313,8 @@ class MergeRequestDiff < ActiveRecord::Base
# merge_request_diff_commits.reload is preferred way to reload associated
# objects but it returns cached result for some reason in this case
commits = merge_request_diff_commits(true)
# we can circumvent that by specifying that we need an uncached reload
commits = self.class.uncached { merge_request_diff_commits.reload }
self.commits_count = commits.size
end

View File

@ -0,0 +1,5 @@
---
title: Passing an argument to force an association to reload is now deprecated
merge_request: 23334
author: Jasper Maes
type: other