From the readme, this is a valid use case:
instances = [instance1, instance2]
MyModel.with_explicit_persistence_for(instances) do
instances.destroy_all
end
However, instances is an array, whereas destroy_all is a method on ActiveRecord_Relation, and passing in a relation causes a Sorbet error. I could make this work as follows:
instances = MyModel.where(some_criteria)
MyModel.with_explicit_persistence_for(instances.to_a) do
instances.destroy_all
end
but I would think with_explicit_persistence_for should allow an ActiveRecord_Relation to be passed in.
I can draft a PR when I have some free time.
From the readme, this is a valid use case:
However,
instancesis an array, whereasdestroy_allis a method onActiveRecord_Relation, and passing in a relation causes a Sorbet error. I could make this work as follows:but I would think
with_explicit_persistence_forshould allow anActiveRecord_Relationto be passed in.I can draft a PR when I have some free time.