{"action":"created","issue":{"url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/881","repository_url":"https://api.github.com/repos/rmosolgo/graphql-ruby","labels_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/881/labels{/name}","comments_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/881/comments","events_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/881/events","html_url":"https://github.com/rmosolgo/graphql-ruby/issues/881","id":249299442,"number":881,"title":"How can I get the parent fields from ctx?","user":{"login":"gottfrois","id":943784,"avatar_url":"https://avatars1.githubusercontent.com/u/943784?v=4","gravatar_id":"","url":"https://api.github.com/users/gottfrois","html_url":"https://github.com/gottfrois","followers_url":"https://api.github.com/users/gottfrois/followers","following_url":"https://api.github.com/users/gottfrois/following{/other_user}","gists_url":"https://api.github.com/users/gottfrois/gists{/gist_id}","starred_url":"https://api.github.com/users/gottfrois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gottfrois/subscriptions","organizations_url":"https://api.github.com/users/gottfrois/orgs","repos_url":"https://api.github.com/users/gottfrois/repos","events_url":"https://api.github.com/users/gottfrois/events{/privacy}","received_events_url":"https://api.github.com/users/gottfrois/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-10T10:17:57Z","updated_at":"2017-08-21T20:46:47Z","closed_at":null,"body":"Hey guys,\r\n\r\nI was looking for a way to get the parent objects from the `ctx` variable but could not find anything. Here is an example:\r\n\r\n```\r\nquery {\r\n  user(id: 1) {\r\n    abilities(first: 10) {\r\n      edges {\r\n        node {\r\n          name\r\n          pricing {\r\n            cost\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThe `pricing resolver look like that:\r\n\r\n```ruby\r\nfield :pricing, Types::Ability::PricingType do\r\n  resolve -> ability, args, ctx {\r\n    user = ???\r\n    ability.pricing_for(user)\r\n  }\r\nend\r\n```\r\n\r\nHow can I get the `user` from the `user(id: 1)` root query?\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/comments/323848594","html_url":"https://github.com/rmosolgo/graphql-ruby/issues/881#issuecomment-323848594","issue_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/881","id":323848594,"user":{"login":"nemoDreamer","id":9303,"avatar_url":"https://avatars3.githubusercontent.com/u/9303?v=4","gravatar_id":"","url":"https://api.github.com/users/nemoDreamer","html_url":"https://github.com/nemoDreamer","followers_url":"https://api.github.com/users/nemoDreamer/followers","following_url":"https://api.github.com/users/nemoDreamer/following{/other_user}","gists_url":"https://api.github.com/users/nemoDreamer/gists{/gist_id}","starred_url":"https://api.github.com/users/nemoDreamer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemoDreamer/subscriptions","organizations_url":"https://api.github.com/users/nemoDreamer/orgs","repos_url":"https://api.github.com/users/nemoDreamer/repos","events_url":"https://api.github.com/users/nemoDreamer/events{/privacy}","received_events_url":"https://api.github.com/users/nemoDreamer/received_events","type":"User","site_admin":false},"created_at":"2017-08-21T20:46:47Z","updated_at":"2017-08-21T20:46:47Z","body":"@gottfrois I found that you can get an Array of `Argument`s by doing `ctx.irep_node.parent.ast_node.arguments`, but I agree that there _has_ to be a simpler way.\r\n(I find the lack of getters here pretty discouraging...)\r\n\r\nThere's no way to get a true `Arguments` object, like the `args` one, w/ a `to_h` method, etc..."}}
{"actor":{"display_login":"nemoDreamer"}}