Search code examples
ruby-on-railsgraphqlrubygemsruby-on-rails-6graphiql

How to enable header_editor_enable in graphiql-rails gem?


How can i set header_editor_enable as true in graphiql-rails gem? There is no graphiql config file in my project. So, I've created it in config/initializers/graphiql.rb but I don't know how to set it true.

How can I do it?


Solution

  • The change with header_editor_enable is not released yet as of 02.12.2021. What you can do is change your Gemfile to point to the latest master of the gem

    # Gemfile
    gem "graphiql-rails", git: "https://github.com/rmosolgo/graphiql-rails.git", branch: "master"
    

    Then in your initializer, add header_editor_enabled option as

    # config/initializers/graphiql.rb
    GraphiQL::Rails.config.header_editor_enabled = true
    

    You are good to go

    screen_shot_of_editor_with_header_section