Skip to content

Instantly share code, notes, and snippets.

@handshake-engineering-blog
Last active June 23, 2021 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save handshake-engineering-blog/846d28a3ea0616686183d9b5c2bc710e to your computer and use it in GitHub Desktop.
Save handshake-engineering-blog/846d28a3ea0616686183d9b5c2bc710e to your computer and use it in GitHub Desktop.
17_1
require "batch-loader"
class SizeBatchLoader < BatchLoader::GraphQL
def sync
# The sync method in the superclass will return an ActiveRecord Relation with all of the objects that have been queried for - all this has class has to do is get the number of those objects
super.size
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment