A lot of models in our application have a chain query. Something like this:
scope :chain, ->(c) { where(chain: c) }
This works fine in Ruby 2.5, the current version we are using. But in Ruby 2.6, an Enumerator#chain method was added. So now, an expression like this:
criteria = Model.other_query.chain(@chain)
will call the Enumerator method (which returns an Enumerator::Chain object) instead of the model query.
It works fine if I use the chain method first:
criteria = Model.chain(@chain).other_query
Is there a way to get the expression to call the model query instead that does not involve renaming all the instances of our chain method, or rearranging all the calls?
Cheers!