{"action":"closed","number":8,"pull_request":{"url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8","id":62407249,"html_url":"https://github.com/goco-inc/graphql-activerecord/pull/8","diff_url":"https://github.com/goco-inc/graphql-activerecord/pull/8.diff","patch_url":"https://github.com/goco-inc/graphql-activerecord/pull/8.patch","issue_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/8","number":8,"state":"closed","locked":false,"title":"Adding batching for association access","user":{"login":"theorygeek","id":7850196,"avatar_url":"https://avatars.githubusercontent.com/u/7850196?v=3","gravatar_id":"","url":"https://api.github.com/users/theorygeek","html_url":"https://github.com/theorygeek","followers_url":"https://api.github.com/users/theorygeek/followers","following_url":"https://api.github.com/users/theorygeek/following{/other_user}","gists_url":"https://api.github.com/users/theorygeek/gists{/gist_id}","starred_url":"https://api.github.com/users/theorygeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theorygeek/subscriptions","organizations_url":"https://api.github.com/users/theorygeek/orgs","repos_url":"https://api.github.com/users/theorygeek/repos","events_url":"https://api.github.com/users/theorygeek/events{/privacy}","received_events_url":"https://api.github.com/users/theorygeek/received_events","type":"User","site_admin":false},"body":"* Improves the batching support for GraphQL queries\r\n\r\n#### Before\r\nWhen you defined a `proxy_to`, `has_one`, or `has_many_array`, this gem would build a path that described how to get from the starting model (eg, `Employee`) to the end model (eg, `[:person, :address]`).\r\n\r\nIt would then use a loop to successively load each model by accessing the association property (eg, `employee.send(:person)`).\r\n\r\nThis relied on the `golidloader` gem, which is smart enough to know that if I have a collection of employees, and I access the `person` on the first one, it should actually load the `person` for _all_ of them.\r\n\r\nThe limitation is that `goldiloader` starts getting tripped up if you are accessing values more than one level deep (eg, `employee.manager.person`), or if you've customized the association (eg, `.includes`, `.limit`, etc).\r\n\r\n#### After\r\nAssociations that are _not_ connections (ie, `proxy_to`, `has_one`, `has_many_array`) are now loaded using `graphql-batch`'s promise system.\r\n\r\nWhen accessing a field that uses one of these values, the field will actually return a _promise_ that will eventually resolve to the value that you need. The `graphql-batch` gem knows how to batch together queries that are trying to access the same type of model.\r\n\r\nAlso, it's smarter about how it handles models once they're loaded:\r\n* If it retrieved the model from the database previously, it caches it for the same GraphQL query and will use it later if it's requested again. (For example, Employee -> Manager if the manager was already loaded)\r\n* When it loads the models, it makes sure to update the associations, so that active record knows that the model has been loaded","created_at":"2016-03-10T15:34:31Z","updated_at":"2016-03-10T21:25:23Z","closed_at":"2016-03-10T21:25:22Z","merged_at":"2016-03-10T21:25:22Z","merge_commit_sha":"7c14f15ea3c03b1faee4ac4e9a11257e7460cecc","assignee":{"login":"jongbeau","id":2096970,"avatar_url":"https://avatars.githubusercontent.com/u/2096970?v=3","gravatar_id":"","url":"https://api.github.com/users/jongbeau","html_url":"https://github.com/jongbeau","followers_url":"https://api.github.com/users/jongbeau/followers","following_url":"https://api.github.com/users/jongbeau/following{/other_user}","gists_url":"https://api.github.com/users/jongbeau/gists{/gist_id}","starred_url":"https://api.github.com/users/jongbeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongbeau/subscriptions","organizations_url":"https://api.github.com/users/jongbeau/orgs","repos_url":"https://api.github.com/users/jongbeau/repos","events_url":"https://api.github.com/users/jongbeau/events{/privacy}","received_events_url":"https://api.github.com/users/jongbeau/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8/commits","review_comments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8/comments","review_comment_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/comments{/number}","comments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/8/comments","statuses_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/statuses/02c854b3de3186117116e38d0bb5422fd9688ac7","head":{"label":"goco-inc:query-batching","ref":"query-batching","sha":"02c854b3de3186117116e38d0bb5422fd9688ac7","user":{"login":"goco-inc","id":10982783,"avatar_url":"https://avatars.githubusercontent.com/u/10982783?v=3","gravatar_id":"","url":"https://api.github.com/users/goco-inc","html_url":"https://github.com/goco-inc","followers_url":"https://api.github.com/users/goco-inc/followers","following_url":"https://api.github.com/users/goco-inc/following{/other_user}","gists_url":"https://api.github.com/users/goco-inc/gists{/gist_id}","starred_url":"https://api.github.com/users/goco-inc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goco-inc/subscriptions","organizations_url":"https://api.github.com/users/goco-inc/orgs","repos_url":"https://api.github.com/users/goco-inc/repos","events_url":"https://api.github.com/users/goco-inc/events{/privacy}","received_events_url":"https://api.github.com/users/goco-inc/received_events","type":"Organization","site_admin":false},"repo":{"id":51456476,"name":"graphql-activerecord","full_name":"goco-inc/graphql-activerecord","owner":{"login":"goco-inc","id":10982783,"avatar_url":"https://avatars.githubusercontent.com/u/10982783?v=3","gravatar_id":"","url":"https://api.github.com/users/goco-inc","html_url":"https://github.com/goco-inc","followers_url":"https://api.github.com/users/goco-inc/followers","following_url":"https://api.github.com/users/goco-inc/following{/other_user}","gists_url":"https://api.github.com/users/goco-inc/gists{/gist_id}","starred_url":"https://api.github.com/users/goco-inc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goco-inc/subscriptions","organizations_url":"https://api.github.com/users/goco-inc/orgs","repos_url":"https://api.github.com/users/goco-inc/repos","events_url":"https://api.github.com/users/goco-inc/events{/privacy}","received_events_url":"https://api.github.com/users/goco-inc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/goco-inc/graphql-activerecord","description":"","fork":false,"url":"https://api.github.com/repos/goco-inc/graphql-activerecord","forks_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/forks","keys_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/teams","hooks_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/hooks","issue_events_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/events{/number}","events_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/events","assignees_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/assignees{/user}","branches_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/branches{/branch}","tags_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/tags","blobs_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/refs{/sha}","trees_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/statuses/{sha}","languages_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/languages","stargazers_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/stargazers","contributors_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/contributors","subscribers_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/subscribers","subscription_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/subscription","commits_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/commits{/sha}","git_commits_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/commits{/sha}","comments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/comments{/number}","issue_comment_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/comments{/number}","contents_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/contents/{+path}","compare_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/merges","archive_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/downloads","issues_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues{/number}","pulls_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls{/number}","milestones_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/milestones{/number}","notifications_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/labels{/name}","releases_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/releases{/id}","deployments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/deployments","created_at":"2016-02-10T17:07:40Z","updated_at":"2016-02-11T16:39:31Z","pushed_at":"2016-03-10T21:25:23Z","git_url":"git://github.com/goco-inc/graphql-activerecord.git","ssh_url":"git@github.com:goco-inc/graphql-activerecord.git","clone_url":"https://github.com/goco-inc/graphql-activerecord.git","svn_url":"https://github.com/goco-inc/graphql-activerecord","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"goco-inc:master","ref":"master","sha":"2b4ff80f7bee031bac184810263e76d3423525ec","user":{"login":"goco-inc","id":10982783,"avatar_url":"https://avatars.githubusercontent.com/u/10982783?v=3","gravatar_id":"","url":"https://api.github.com/users/goco-inc","html_url":"https://github.com/goco-inc","followers_url":"https://api.github.com/users/goco-inc/followers","following_url":"https://api.github.com/users/goco-inc/following{/other_user}","gists_url":"https://api.github.com/users/goco-inc/gists{/gist_id}","starred_url":"https://api.github.com/users/goco-inc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goco-inc/subscriptions","organizations_url":"https://api.github.com/users/goco-inc/orgs","repos_url":"https://api.github.com/users/goco-inc/repos","events_url":"https://api.github.com/users/goco-inc/events{/privacy}","received_events_url":"https://api.github.com/users/goco-inc/received_events","type":"Organization","site_admin":false},"repo":{"id":51456476,"name":"graphql-activerecord","full_name":"goco-inc/graphql-activerecord","owner":{"login":"goco-inc","id":10982783,"avatar_url":"https://avatars.githubusercontent.com/u/10982783?v=3","gravatar_id":"","url":"https://api.github.com/users/goco-inc","html_url":"https://github.com/goco-inc","followers_url":"https://api.github.com/users/goco-inc/followers","following_url":"https://api.github.com/users/goco-inc/following{/other_user}","gists_url":"https://api.github.com/users/goco-inc/gists{/gist_id}","starred_url":"https://api.github.com/users/goco-inc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goco-inc/subscriptions","organizations_url":"https://api.github.com/users/goco-inc/orgs","repos_url":"https://api.github.com/users/goco-inc/repos","events_url":"https://api.github.com/users/goco-inc/events{/privacy}","received_events_url":"https://api.github.com/users/goco-inc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/goco-inc/graphql-activerecord","description":"","fork":false,"url":"https://api.github.com/repos/goco-inc/graphql-activerecord","forks_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/forks","keys_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/teams","hooks_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/hooks","issue_events_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/events{/number}","events_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/events","assignees_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/assignees{/user}","branches_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/branches{/branch}","tags_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/tags","blobs_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/refs{/sha}","trees_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/statuses/{sha}","languages_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/languages","stargazers_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/stargazers","contributors_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/contributors","subscribers_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/subscribers","subscription_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/subscription","commits_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/commits{/sha}","git_commits_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/git/commits{/sha}","comments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/comments{/number}","issue_comment_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/comments{/number}","contents_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/contents/{+path}","compare_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/merges","archive_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/downloads","issues_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues{/number}","pulls_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls{/number}","milestones_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/milestones{/number}","notifications_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/labels{/name}","releases_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/releases{/id}","deployments_url":"https://api.github.com/repos/goco-inc/graphql-activerecord/deployments","created_at":"2016-02-10T17:07:40Z","updated_at":"2016-02-11T16:39:31Z","pushed_at":"2016-03-10T21:25:23Z","git_url":"git://github.com/goco-inc/graphql-activerecord.git","ssh_url":"git@github.com:goco-inc/graphql-activerecord.git","clone_url":"https://github.com/goco-inc/graphql-activerecord.git","svn_url":"https://github.com/goco-inc/graphql-activerecord","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8"},"html":{"href":"https://github.com/goco-inc/graphql-activerecord/pull/8"},"issue":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/8"},"comments":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/goco-inc/graphql-activerecord/statuses/02c854b3de3186117116e38d0bb5422fd9688ac7"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"theorygeek","id":7850196,"avatar_url":"https://avatars.githubusercontent.com/u/7850196?v=3","gravatar_id":"","url":"https://api.github.com/users/theorygeek","html_url":"https://github.com/theorygeek","followers_url":"https://api.github.com/users/theorygeek/followers","following_url":"https://api.github.com/users/theorygeek/following{/other_user}","gists_url":"https://api.github.com/users/theorygeek/gists{/gist_id}","starred_url":"https://api.github.com/users/theorygeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theorygeek/subscriptions","organizations_url":"https://api.github.com/users/theorygeek/orgs","repos_url":"https://api.github.com/users/theorygeek/repos","events_url":"https://api.github.com/users/theorygeek/events{/privacy}","received_events_url":"https://api.github.com/users/theorygeek/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":2,"additions":240,"deletions":23,"changed_files":7}}