Skip to content

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

@Yoshiji

Description

@Yoshiji

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions