Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Conversation

@xuorig
Copy link
Collaborator

@xuorig xuorig commented Feb 11, 2017

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also be better if we have model on metadata, think it would be cool


object_from_id ->(id, query_ctx) do
gid = GlobalID.parse(id)
Object.const_get(gid.model_name).find(gid.model_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm a bit paranoid, but think we should do this?

type_name = uri.model_name.to_sym

if uri.app != GlobalID.app || !Graph::Types.constants.include?(type_name)
  raise GraphQL::ExecutionError, "Invalid gid: #{gid}"
end

Object.const_get(gid.model_name).find(gid.model_id)


object_from_id ->(id, query_ctx) do
gid = GlobalID.parse(id)
possible_types = query_ctx.warden.possible_types(GraphQL::Relay::Node.interface)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @cjoudrey good point, I think this is more even more accurate ^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Forgot about this.

@xuorig
Copy link
Collaborator Author

xuorig commented Feb 11, 2017

merging to keep going forward, let me know if you find anything else, will fix

@xuorig xuorig merged commit 2c57d4c into master Feb 11, 2017
@xuorig xuorig deleted the node branch February 11, 2017 20:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants