Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant GraphiQL::Rails::EditorsController #43

Closed
degzcs opened this issue Apr 12, 2018 · 20 comments
Closed

uninitialized constant GraphiQL::Rails::EditorsController #43

degzcs opened this issue Apr 12, 2018 · 20 comments

Comments

@degzcs
Copy link

degzcs commented Apr 12, 2018

Hi,
I'm getting this error when try to access to http://localhost:3000/graphiql

uninitialized constant GraphiQL::Rails::EditorsController

I've already installed graphql and graphiql gems

gem rails '5.1.6'

gem 'graphql', '1.7.4'
gem 'graphiql-rails', '1.4.10', group: :development  

NOTE: I already try with 'graphiql-rails', '1.4.4' and it didn't work

The weird thing is that the classes Config Engine VERSION have been loaded by not the EditorsController.

Seems that the problem is how the gem is requiring the rails embedded app.

I really appreciate your support to fix this issue.
Thanks

@rmosolgo
Copy link
Owner

Hi, sorry to hear about that error!

I'm really not sure what to say, and I agree that it's strange that the other constants would load properly but not EditorsController.

It looks like the last CI run used Rails 5.1.5: https://travis-ci.org/rmosolgo/graphiql-rails/jobs/351319980#L1275

So I would expect 5.1.6 to work just fine! Are you able to replicate the issue on a newly-created rails 5.1.6 application?

@degzcs
Copy link
Author

degzcs commented Apr 12, 2018

I've created a new project with only the basic and it works like a charm. But in my project it doesn't.
This is my complete Gemfile

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# API
gem 'graphql', '1.7.4'
gem 'graphiql-rails', '1.4.4', group: :development
#gem 'search_object', '1.2.0'
#gem 'search_object_graphql', '0.1'

gem 'dry-struct'

gem 'rest-client'
gem 'alegra'

# upload files
gem 'fog-aws'
gem 'carrierwave'
gem 'mini_magick'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'annotate'
gem 'figaro'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.1.6'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'

group :development, :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'spirit_hands'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'rubocop', '~> 0.36.0', require: false
  gem 'guard-rubocop', '~> 1.2.0'
  gem 'rubycritic', '~> 2.7.0', require: false
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  #gem 'spring'
  #gem 'spring-watcher-listen', '~> 2.0.0'
  #gem 'rerun'
end

group :test do 
  gem 'vcr'
  gem 'webmock'
  gem 'database_cleaner'
end

is it possible that another gem is causing this error?
I try to remove figaro gem in case that it would be an initial environment variable, but it didn't work.

any other idea?

@rmosolgo
Copy link
Owner

Could you share the full error and stack trace?

Could you share these two arrays:

ActiveSupport::Dependencies.autoload_paths
ActiveSupport::Dependencies.autoload_paths.grep(/graphiql/)

The gem's paths should be in that list.

Is your app "API-only" mode? There are some issues with that, too: #13 But they seem slightly different.

@degzcs
Copy link
Author

degzcs commented Apr 12, 2018

ActiveSupport::Dependencies.autoload_paths
=> [
  [ 0] "/home/diego/code/learning/ruby_all/trazoro-credits/app/assets",
  [ 1] "/home/diego/code/learning/ruby_all/trazoro-credits/app/channels",
  [ 2] "/home/diego/code/learning/ruby_all/trazoro-credits/app/controllers",
  [ 3] "/home/diego/code/learning/ruby_all/trazoro-credits/app/controllers/concerns",
  [ 4] "/home/diego/code/learning/ruby_all/trazoro-credits/app/graphql",
  [ 5] "/home/diego/code/learning/ruby_all/trazoro-credits/app/helpers",
  [ 6] "/home/diego/code/learning/ruby_all/trazoro-credits/app/jobs",
  [ 7] "/home/diego/code/learning/ruby_all/trazoro-credits/app/mailers",
  [ 8] "/home/diego/code/learning/ruby_all/trazoro-credits/app/models",
  [ 9] "/home/diego/code/learning/ruby_all/trazoro-credits/app/models/concerns",
  [10] "/home/diego/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/graphiql-rails-1.4.4/app/assets",
  [11] "/home/diego/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/graphiql-rails-1.4.4/app/controllers",
  [12] "/home/diego/code/learning/ruby_all/trazoro-credits/test/mailers/previews"
]
 ActiveSupport::Dependencies.autoload_paths.grep(/graphiql/)
=> [
  [0] "/home/diego/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/graphiql-rails-1.4.4/app/assets",
  [1] "/home/diego/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/graphiql-rails-1.4.4/app/controllers"
]

No it not "API-only"... I gonna review them and see if they have a fix for it.

@rmosolgo
Copy link
Owner

Huh! the gem paths are there. That's good. can you share the full error and stack trace?

@degzcs
Copy link
Author

degzcs commented Apr 12, 2018

Use Ctrl-C to stop
Started GET "/graphiql" for 127.0.0.1 at 2018-04-12 15:52:06 -0500
   (1.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  
ActionController::RoutingError (uninitialized constant GraphiQL::Rails::EditorsController):
  
activesupport (5.1.6) lib/active_support/inflector/methods.rb:271:in `const_get'
activesupport (5.1.6) lib/active_support/inflector/methods.rb:271:in `block in constantize'
activesupport (5.1.6) lib/active_support/inflector/methods.rb:267:in `each'
activesupport (5.1.6) lib/active_support/inflector/methods.rb:267:in `inject'
activesupport (5.1.6) lib/active_support/inflector/methods.rb:267:in `constantize'
actionpack (5.1.6) lib/action_dispatch/http/request.rb:85:in `controller_class_for'
actionpack (5.1.6) lib/action_dispatch/http/request.rb:78:in `controller_class'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:43:in `controller'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:29:in `serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:844:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
railties (5.1.6) lib/rails/railtie.rb:185:in `public_send'
railties (5.1.6) lib/rails/railtie.rb:185:in `method_missing'
actionpack (5.1.6) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.1.6) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:844:in `call'
rack (2.0.4) lib/rack/etag.rb:25:in `call'
rack (2.0.4) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.4) lib/rack/head.rb:12:in `call'
rack (2.0.4) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.4) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.6) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.6) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.6.0) lib/web_console/middleware.rb:137:in `call_app'
web-console (3.6.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.4) lib/rack/method_override.rb:22:in `call'
rack (2.0.4) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.4) lib/rack/sendfile.rb:111:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
puma (3.11.4) lib/puma/configuration.rb:225:in `call'
puma (3.11.4) lib/puma/server.rb:632:in `handle_request'
puma (3.11.4) lib/puma/server.rb:446:in `process_client'
puma (3.11.4) lib/puma/server.rb:306:in `block in run'
puma (3.11.4) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

@rmosolgo
Copy link
Owner

It looks right to me :'( The backtrace, does, I mean. But why doesn't that call to const_get use ActiveSupport::Dependencies :S

@jeffsee55
Copy link

jeffsee55 commented Apr 23, 2018

Just want to mention I'm seeing this too, I've tried different versions as well. We're on ruby 2.3.6 and rails 4.2. I was hoping to find some similarities in the Gemfile with @degzcs but there doesn't seem to be anything too obvious there (we have a large Gemfile, happy to share if that would help). Stack trace looks similar:

^LI, [2018-04-24T08:17:33.844579 #75551]  INFO -- : Started GET "/graphiql" for 127.0.0.1 at 2018-04-24 08:17:33 +1000
D, [2018-04-24T08:17:33.871648 #75551] DEBUG -- :   Entity Load (0.7ms)  SELECT  `entities`.* FROM `entities` WHERE `entities`.`is_active` = 1 AND (LOWER(web_domain) = '9saver.develop') LIMIT 1
E, [2018-04-24T08:17:33.926744 #75551] ERROR -- : Airbrake:
E, [2018-04-24T08:17:33.926804 #75551] ERROR -- :   ActionController::RoutingError: uninitialized constant GraphiQL::Rails::EditorsController
E, [2018-04-24T08:17:33.926841 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant'
E, [2018-04-24T08:17:33.926967 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
E, [2018-04-24T08:17:33.927099 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `rescue in load_missing_constant'
E, [2018-04-24T08:17:33.927276 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:42:in `load_missing_constant'
E, [2018-04-24T08:17:33.927475 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:263:in `const_get'
E, [2018-04-24T08:17:33.927616 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:263:in `block in constantize'
E, [2018-04-24T08:17:33.927761 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:259:in `each'
E, [2018-04-24T08:17:33.927934 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:259:in `inject'
E, [2018-04-24T08:17:33.928090 #75551] ERROR -- :   /Users/jeffsee/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:259:in `constantize'

The same thing occurred when I disabled the bootsnap gem as well so I think those first lines from the stack trace are irrellevant

@seanarnold
Copy link

I also get this error using

graphiql-rails (1.4.10)
graphql (1.7.14)

on Rails 5.2.0

@LogicWolfe
Copy link

I'm seeing it as well.

graphiql-rails (1.4.10)
graphql (1.8.2)

Rails 5.2.0

@LogicWolfe
Copy link

FWIW I was able to track it down to a conflict with an old version of configatron. We saw this error with 2.6.4 and it was resolved by upgrading to 4.5.1.

@nleo
Copy link

nleo commented Aug 7, 2018

same here

@kammerer
Copy link

kammerer commented Sep 11, 2018

I also bumped into this error, but only in staging environment. The reason was that I added the gem to Gemfile's development group.

@rbUUbr
Copy link

rbUUbr commented Feb 26, 2019

Hello! I tried to integrate this gem into existing Rails(not only-api) application through guide from https://graphql-ruby.org. I run commands:

  1. Added gem 'graphql to Gemfile`
  2. bundle install
  3. rails g graphql:install
  4. bundle install
  5. rails s
  6. Navigated in browser to localhost:3000/graphiql
  7. Got error uninitialized constant GraphiQL::Rails::EditorsController
    Stack:
rs
=> Booting Puma
=> Rails 5.1.6.1 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.8.2 (ruby 2.4.1-p111), codename: Sassy Salamander
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
I, [2019-02-26T23:36:29.574798 #836]  INFO -- : Started GET "/graphiql" for 127.0.0.1 at 2019-02-26 23:36:29 +0300
D, [2019-02-26T23:36:29.646496 #836] DEBUG -- :    (1.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
F, [2019-02-26T23:36:29.797705 #836] FATAL -- :   
F, [2019-02-26T23:36:29.797888 #836] FATAL -- : ActionController::RoutingError (uninitialized constant GraphiQL::Rails::EditorsController):
F, [2019-02-26T23:36:29.797995 #836] FATAL -- :   
F, [2019-02-26T23:36:29.798109 #836] FATAL -- : activesupport (5.1.6.1) lib/active_support/inflector/methods.rb:271:in `const_get'
activesupport (5.1.6.1) lib/active_support/inflector/methods.rb:271:in `block in constantize'
activesupport (5.1.6.1) lib/active_support/inflector/methods.rb:267:in `each'
activesupport (5.1.6.1) lib/active_support/inflector/methods.rb:267:in `inject'
activesupport (5.1.6.1) lib/active_support/inflector/methods.rb:267:in `constantize'
actionpack (5.1.6.1) lib/action_dispatch/http/request.rb:85:in `controller_class_for'
actionpack (5.1.6.1) lib/action_dispatch/http/request.rb:78:in `controller_class'
actionpack (5.1.6.1) lib/action_dispatch/routing/route_set.rb:43:in `controller'
actionpack (5.1.6.1) lib/action_dispatch/routing/route_set.rb:29:in `serve'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6.1) lib/action_dispatch/routing/route_set.rb:844:in `call'
railties (5.1.6.1) lib/rails/engine.rb:522:in `call'
railties (5.1.6.1) lib/rails/railtie.rb:185:in `public_send'
railties (5.1.6.1) lib/rails/railtie.rb:185:in `method_missing'
actionpack (5.1.6.1) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.1.6.1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6.1) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6.1) lib/action_dispatch/routing/route_set.rb:844:in `call'
meta_request (0.4.3) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
meta_request (0.4.3) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
i18n-js (3.0.0) lib/i18n/js/middleware.rb:14:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.6) lib/rack/etag.rb:25:in `call'
rack (2.0.6) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.6) lib/rack/head.rb:12:in `call'
rack (2.0.6) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.6) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.6.1) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.6.1) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.6.1) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.0) lib/web_console/middleware.rb:18:in `call'
rack-contrib (1.2.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.4.3) lib/meta_request/middlewares/headers.rb:16:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.3.2) lib/request_store/middleware.rb:9:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.6) lib/rack/method_override.rb:22:in `call'
rack (2.0.6) lib/rack/runtime.rb:22:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6.1) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.6) lib/rack/sendfile.rb:111:in `call'
rack-mini-profiler (0.10.5) lib/mini_profiler/profiler.rb:282:in `call'
railties (5.1.6.1) lib/rails/engine.rb:522:in `call'
puma (3.8.2) lib/puma/configuration.rb:224:in `call'
puma (3.8.2) lib/puma/server.rb:600:in `handle_request'
puma (3.8.2) lib/puma/server.rb:435:in `process_client'
puma (3.8.2) lib/puma/server.rb:299:in `block in run'
puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
logging (2.0.0) lib/logging/diagnostic_context.rb:448:in `block in create_with_logging_context'

UPD: (bad solution) FYI, I hardcoded requiring of EditorsController to Rails engine, and hardcoded render:

      def show
        render file: 'graphiql/rails/editors/show'
      end

rails.rb:

require "rails"

if ActiveSupport::Inflector.method(:inflections).arity == 0
  # Rails 3 does not take a language in inflections.
  ActiveSupport::Inflector.inflections do |inflect|
    inflect.acronym("GraphiQL")
  end
else
  ActiveSupport::Inflector.inflections(:en) do |inflect|
    inflect.acronym("GraphiQL")
  end
end

require "graphiql/rails/config"
require "graphiql/rails/engine"
require "graphiql/rails/version"
require_relative "../../app/controllers/graphiql/rails/editors_controller"

module GraphiQL
  module Rails
    class << self
      attr_accessor :config
    end

    self.config = Config.new
  end
end

@Freitas29
Copy link

Freitas29 commented Aug 8, 2019

@degzcs #41 (comment) this solve your problem.

`group :development do

gem 'graphiql-rails'

end`

@ngouy
Copy link

ngouy commented Dec 5, 2019

same problem here, so far I didn't found any solution

@benguest-drizly
Copy link

benguest-drizly commented Mar 17, 2020

Same problem here, finally figured that another gem I was including was overwriting the #underscore method on String... Which was causing this issue.

@remz99
Copy link

remz99 commented Apr 17, 2020

I ran into this issue after upgrading to Rails 6. I was able to resolve it by adding 'graphiql' => 'GraphiQL' to the list of inflections for Zeitwerk.

Rails.autoloaders.each do |autoloader|
  autoloader.inflector = Zeitwerk::Inflector.new
  autoloader.inflector.inflect(
    'graphiql' => 'GraphiQL'
  )
end

@sarahyaepark
Copy link

sarahyaepark commented May 10, 2021

@drizlyben Same issue here! Caused by the method underscore in the gem googl.
Getting rid of the gem in my Gemfile, and then running bundle install fixed this original issue for me.

@rmosolgo
Copy link
Owner

Hey everyone, thanks for sharing what you found here. I'm going to close this issue since it hasn't been updated in almost three years. If anyone runs into this trouble again, please open a new issue.

For reference, here's where this library registers GraphiQL:

if ActiveSupport::Inflector.method(:inflections).arity == 0
# Rails 3 does not take a language in inflections.
ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym("GraphiQL")
end
else
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym("GraphiQL")
end
end

And that's still the recommended way to specify custom inflections (https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html#customizing-inflections), but if you have other customizations, you may have to register "GraphiQL" yourself somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests