Rails 5 deprecation: Passing an argument to force an association to reload is now deprecated
What does this MR do?
Fixes DEPRECATION WARNING: Passing an argument to force an association to reload is now deprecated and will be removed in Rails 5.1. Please call `reload` on the result collection proxy instead. (called from save_commits at /builds/gitlab-org/gitlab-ce/app/models/merge_request_diff.rb:316)
Just using merge_request_diff_commits.reload
doesn't work. When using merge_request_diff_commits(true)
rails uses an uncached connection, see https://github.com/rails/rails/blob/8688fc4e404e687fe66c7ac214c33ea82710f57e/activerecord/lib/active_record/associations/collection_association.rb#L37. So we can remove the deprecation by explicitly using ActiveRecord::Base.uncached { merge_request_diff_commits.reload }
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.