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

Allow field option preload: true and use the field's name as relation name #9

Open
Yoshiji opened this issue Nov 13, 2017 · 3 comments

Comments

@Yoshiji
Copy link

Yoshiji commented Nov 13, 2017

I was playing with this gem and found out that:

# user object type
field :posts, !types[!PostType] do
 preload :posts
end
# is the same as
field :posts, !types[!PostType], preload: :posts

It would be cool to be able to do a simple preload: true as an option, and it would resolve to the field's name:

field :posts, !types[!PostType], preload: true 
# would resolve to
field :posts, !types[!PostType], preload: :posts

So you would need to give an explicit argument if the relation name does not match the field's name or if you want more than a single relation preload.

What do you think? I could try to add this feature if I am not the only one finding it relevant.

@cameronbourgeois
Copy link

This sounds nice @Yoshiji :) I would prefer your simplified syntax over having to open a new block to defined a single preload

@mareczek
Copy link

This looks really nice! Is this considered?

@Yoshiji
Copy link
Author

Yoshiji commented Aug 27, 2018

I forgot to work on this... I still consider doing it, but I won't be able to do so until few weeks... Don't hesitate to take over this project if you want it ready sooner.

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