Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference based on conventions #163

Open
chrisortman opened this issue Oct 17, 2020 · 3 comments
Open

Inference based on conventions #163

chrisortman opened this issue Oct 17, 2020 · 3 comments

Comments

@chrisortman
Copy link

Hello. I can't quite tell if this library will infer any controller actions and model based on conventions or if I am supposed to always specify it.

resources :users

We could infer:

model('User')
action(:show).returns_single
action(:index).returns_list
action(:create).returns_single
action(:update).returns_single
action(:destroy).returns_single

I don't see these lines in the example, but they appear to be required?

@pucinsk
Copy link
Contributor

pucinsk commented Oct 17, 2020

Please explain more what you are trying to achieve.

But basically, if I've correctly understood your question, when you add to graphql router resources :users graphql_rails expects that you have these actions (and methods which correspond to these actions) defined in your graphql rails controller (like in this example.

Also, a great code example about routes and resources actions handling is here.

@chrisortman
Copy link
Author

chrisortman commented Oct 18, 2020 via email

@jusmat
Copy link
Collaborator

jusmat commented Dec 22, 2020

Hey, @chrisortman. Sorry for the delayed response, but just to be short - defining a resource currently does not define actions in the controller itself, meaning you have to add them manually. However, you're correct on it sort of misleading you in the documentation/examples, and we'll update that soon. Leaving the issue as open before we do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants