exAspArk / batch-loader

:zap: Powerful tool for avoiding N+1 DB or HTTP queries
https://engineering.universe.com/batching-a-powerful-way-to-solve-n-1-queries-every-rubyist-should-know-24e20c6e7b94
MIT License
1.04k stars 52 forks source link

Allow passing custom key to BatchLoader#batch #12

Closed exAspArk closed 6 years ago

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 99.721% when pulling 6be8061140ab7429fa387e92c64cb6b67e6b1361 on dlanileonardo-master into a5293963b221e0725ec4d1d284b9aabcb2d8ef0e on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 99.721% when pulling ba887f38c033c6a0fbf53f8cec54a4229860ad39 on dlanileonardo-master into a5293963b221e0725ec4d1d284b9aabcb2d8ef0e on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.01%) to 99.72% when pulling 7807dada6fb6cb9b95e5115c7f219f512360ec4f on dlanileonardo-master into a5293963b221e0725ec4d1d284b9aabcb2d8ef0e on master.

exAspArk commented 6 years ago

Released it in the 1.2.0 version. Thank you guys for your contribution and help! 🎉

mathieul commented 6 years ago

Thank you for all the work you put into this gem and thank you to all who worked on this PR. It now allows to generate code to avoid boilerplate in common patterns, so I wrote a mixin using batch-loader to generate lazy active record associations.

I've also packaged it as a gem in case it is useful to others: https://github.com/mathieul/batch-loader-active-record.

exAspArk commented 6 years ago

@mathieul wow, looks awesome! 😍

I remember some people on Reddit were willing to have batch-loader implemented in ActiveRecord. Your gem finally allows to integrate them together!

Thank you for sharing!