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

Fix keyword arguments #34

Closed snwfog closed 5 years ago

snwfog commented 5 years ago

Attempt to fix #33

If there is only an item, this case is valid, else raise exception for missing argument. Elsif both block && value are present, raise exception for having too many arguments. Elsif both block && value are missing, this is valid case. Else either block and value are present, this is a valid case.

Also, the spec works even if the loaded values is nil doesn't seems to be valid, because User.where returns empty array, so the loader block is never called. This seems to be the reason why this bug got slipped.

ghost commented 5 years ago

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.