Commit a224b760 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'deprecated-force-reload' into 'master'

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

See merge request gitlab-org/gitlab-ce!24136
parents 7e8712e2 16c1c0b1
...@@ -5,8 +5,8 @@ module ManualInverseAssociation ...@@ -5,8 +5,8 @@ module ManualInverseAssociation
class_methods do class_methods do
def manual_inverse_association(association, inverse) def manual_inverse_association(association, inverse)
define_method(association) do |*args| define_method(association) do
super(*args).tap do |value| super().tap do |value|
next unless value next unless value
child_association = value.association(inverse) child_association = value.association(inverse)
......
---
title: 'Fix deprecation: Passing an argument to force an association to reload is
now deprecated'
merge_request: 24136
author: Jasper Maes
type: other
...@@ -32,10 +32,10 @@ describe ManualInverseAssociation do ...@@ -32,10 +32,10 @@ describe ManualInverseAssociation do
.not_to exceed_query_limit(0) .not_to exceed_query_limit(0)
end end
it 'passes arguments to the default association method, to allow reloading' do it 'allows reloading the relation' do
query_count = ActiveRecord::QueryRecorder.new do query_count = ActiveRecord::QueryRecorder.new do
instance.manual_association instance.manual_association
instance.manual_association(true) instance.reload_manual_association
end.count end.count
expect(query_count).to eq(2) expect(query_count).to eq(2)
......
...@@ -199,7 +199,7 @@ describe GpgKey do ...@@ -199,7 +199,7 @@ describe GpgKey do
gpg_key.revoke gpg_key.revoke
expect(gpg_key.subkeys(true)).to be_blank expect(gpg_key.subkeys.reload).to be_blank
end end
it 'invalidates all signatures associated to the subkeys' do it 'invalidates all signatures associated to the subkeys' do
......
...@@ -762,7 +762,7 @@ describe Ci::ProcessPipelineService, '#execute' do ...@@ -762,7 +762,7 @@ describe Ci::ProcessPipelineService, '#execute' do
end end
def manual_actions def manual_actions
pipeline.manual_actions(true) pipeline.manual_actions.reload
end end
def create_build(name, **opts) def create_build(name, **opts)
......
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