Comments (3)
Yes, that's just what scope_items
is for -- sounds good! Please let me know if you have any other questions or trouble with it.
from graphql-ruby.
Have you looked into the auto-loading argument feature? https://graphql-ruby.org/mutations/mutation_classes.html#auto-loading-arguments
It automatically runs authorized?
like you're doing in addition to the loading
from graphql-ruby.
@swalkinshaw Thanks Scott! That auto-loading argument feature you suggested works for all of my mutations which take an Author as an argument.
I have another question which I will demonstrate with an example. In this example, I have a query named allAuthors
and another query named all_authors_with_id_less_than_ten
as shown in the code snippet below
module Types
class QueryType < Types::BaseObject
field :all_authors, [Types::AuthorType], null: false
def all_authors
Author.all
end
field :all_authors_with_id_less_than_ten, [Types::AuthorType], null: false
def all_authors_with_id_less_than_ten
Author.where('id < 10')
end
end
end
Now, I want to restrict these two queries to only show authors that have an id of 1. My solution uses scope_items
, and I was just wondering if using scope_items
is the best way to solve this type of problem.
from graphql-ruby.
Related Issues (20)
- 2.3.1 changes previous mutation behaviour re optional arguments HOT 6
- new in 2.3.1: Arrays of inputs previously "prepared" now not "prepared" HOT 4
- Issue overriding the "authorized?" method in BaseField HOT 2
- [Question]: Implementing input validation across the entire schema HOT 2
- OperationStore index appears to fail with nil comparsion HOT 10
- `one_of` directive doesn't work in `InputObject`s with `ActionController::Parameters` HOT 4
- Query#fingerprint raises "TypeError: no implicit conversion of nil into String" HOT 2
- [PRO] Can't get custom directive from a document retrieved from the operation store HOT 3
- Query validation never finishes on queries with many directives HOT 3
- Integrate with ActiveRecord::QueryLogs (old marginalia) HOT 5
- DataDog APM not receiving data HOT 10
- Defer is not working on fragments HOT 10
- Incompatible tracers (PrometheusTrace & SentryTrace) HOT 1
- `GraphQL::Language::Nodes::Document` is not compatible with Marshal in version 2.3 HOT 1
- Guide: Mutation authorization HOT 2
- Support directives on resolvers and mutations
- `current_field` is reset in exceptions HOT 3
- Schema type system clean-up
- dataloaders not working in autoloaded mutation arguments
- Unable to use `type` as enum value HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-ruby.