Skip to content

vivekmiyani/phantom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phantom

Graphql

Shorthand

  • Includes enum shorthand,

    field :status, enum("PersonStatusEnum", Person.statuses.keys), null: false

Response handler

  • Catches errors automatically:

    • ActiveRecord::RecordNotFound
  • Includes raise_error response handler in GraphQL::Schema::RelayClassicMutation

    raise_error person.errors.full_messages.to_sentence unless person.update(status: :active)

Authorization

  • Add authorize option to field

    # app/graphql/types/base_field.rb
    
    field_class.include(Phantom::Graphql::Authorization)
    field :posts, [Types::PostType], authorize: "PostPolicy#index?", null: false

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Languages