README.md in graphql-preload-1.0.1 vs README.md in graphql-preload-1.0.2
- old
+ new
@@ -1,6 +1,6 @@
-# Graphql::Preload
+# GraphQL::Preload
Provides a DSL for the [`graphql` gem](https://github.com/rmosolgo/graphql-ruby) that allows ActiveRecord associations to be preloaded in field definitions. Based on a [gist](https://gist.github.com/theorygeek/a1a59a2bf9c59e4b3706ac68d12c8434) by @theorygeek.
## Installation
@@ -34,9 +34,15 @@
name 'Post'
field :comments, !types[!CommentType] do
# Post.includes(:comments)
preload :comments
+
+ # Post.includes(:comments, :authors)
+ preload [:comments, :authors]
+
+ # Post.includes(:comments, authors: [:posts, :followers])
+ preload [:comments, { authors: [:posts, :followers] }]
resolve ->(obj, args, ctx) { obj.comments }
end
end