Hey @Joey_A, are you just looking to wrap a block with an overridden client context? I don’t think there’s an “official” way to do this, but might be an interesting feature request.
Does the following sort of suit your needs, or is there more detail you can share?
def multi_with(models, settings, &block)
first, *rest = models
first.with(settings) do
if rest.empty?
yield
else
multi_with(rest, settings, &block)
end
end
end
multi_with([ Person, User ], { read: :primary }) do
# ...
end
Note the above isn’t tested
If I can get some more info about exactly what you’re looking to achieve we can get a feature request opened accordingly.