Closed woahstorkdork closed 6 years ago
I just figured out what you meant in the documentation, that you can access the context
from within scope:
scope { context[:current_user] }
perhaps it would benefit other users to have an explicit example in the documentation ? or maybe I'm the only slow one ;)
@woahstorkdork Adding an example if a good idea. Will try to do it :)
I've implemented the filtering example from how-to-graphql and it is working fine; however, I want to access the context object in order to add authentication/authorization to the search object resolver.
I've unsuccessfully tried setting binding.pry inside of the Resolvers::LinksSearch class in order to see if I can access the
context
object.I'm wondering how I can pass/access
context
within the Resolvers::DispensariesSearch class:field :allDispensaries, function: Resolvers::LinksSearch
like I can in a simple field:Is this possible using the SearchObject plugin ? Should I define a initialize method for the Resolvers::LinksSearch and pass in context as argument when creating a new instance ?
Any and all help would be greatly appreciated !