LoginSignup
0

More than 1 year has passed since last update.

posted at

updated at

Organization

ActionController::RoutingError - uninitialized constant GraphiQL::Rails::EditorsController エラーの解決方法

困ったこと

Rails 6 環境でGraphQLを実装するためこちらのサイトを参考に各種セットアップをしていたところでした。

rails generate graphql:install コマンドを実行後、 http://localhost:3000/graphiql を開いたところ、以下エラーが発生した... :sob:

ActionController::RoutingError at /
uninitialized constant GraphiQL::Rails::EditorsController

image.png

前提

  • 以下の Gem を利用している環境とする
    • rails (6.1.3.1)
    • graphql (1.12.8)
    • graphiql-rails (1.7.0)

解決方法

答えは Gem 本家のIssueに投稿されていたコメントでした。以下を追記後、Railsサーバーを再起動したら GraphiQLの画面が表示できました :tada:

config/initializers/zeitwerk.rb
Rails.autoloaders.each do |autoloader|
  autoloader.inflector = Zeitwerk::Inflector.new
+  autoloader.inflector.inflect(
+    'graphiql' => 'GraphiQL'
+  )
end

関連

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0