ar-find-in-batches-with-order icon indicating copy to clipboard operation
ar-find-in-batches-with-order copied to clipboard

Possible edge case when a property_key can't be resolved

Open subelsky opened this issue 4 years ago • 2 comments

Thanks for making this gem, it's super handy! I recently ran into an issue with this line:

https://github.com/nambrot/ar-find-in-batches-with-order/blob/c9639498342ee09d45e5d893b6508ecb4cb1f396/lib/ar-find-in-batches-with-order.rb#L16

we have some code that uses raw SQL and so .orders returns an empty array. In this case, I think the gem should probably raise RuntimeError -- without a property_key a harder-to-diagnose ActiveRecord error occurs: TypeError: nil is not a symbol nor a string

If you agree, I'd be happy to submit a PR.

subelsky avatar Jun 23 '20 15:06 subelsky

Please do :)

nambrot avatar Jun 25 '20 08:06 nambrot

oh awesome! do you have a preference for a testing framework? I'd like to add a little integration test to validate my fix and was planning to use RSpec unless you have any concerns

subelsky avatar Jun 26 '20 18:06 subelsky