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

generator administrate:install fails if ActionCable is disabled #2548

Open
namiwang opened this issue Mar 13, 2024 · 6 comments
Open

generator administrate:install fails if ActionCable is disabled #2548

namiwang opened this issue Mar 13, 2024 · 6 comments
Labels
bug breakages in functionality that is implemented

Comments

@namiwang
Copy link

repro:

  1. initialize new rails app with --skip-action-cable
  2. install and try to init administrate

incorrect behavior:

> rails generate administrate:install
[WARNING] Could not load generator "generators/administrate/install/install_generator". Error: uninitialized constant ActionCable.
/Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/turbo-rails-2.0.4/app/channels/turbo/streams_channel.rb:34:in `<main>'
...
@namiwang namiwang added the bug breakages in functionality that is implemented label Mar 13, 2024
@namiwang namiwang changed the title generator administrate:install fails with ActionCable disabled generator administrate:install fails if ActionCable is disabled Mar 13, 2024
@nickcharlton
Copy link
Member

Oh, that's a pain, thanks for reporting it.

Which version of Administrate are you using? Which of Rails?

@namiwang
Copy link
Author

namiwang commented Mar 27, 2024

The latest stable ones I think. I can confirm later but I doubt it's related to specific versions. Maybe related to new loading mechanism from rails 7 with zeitwerk?

@nickcharlton
Copy link
Member

Yeah, it could be! If you could confirm that'd be great.

@namiwang
Copy link
Author

namiwang commented Mar 27, 2024

Just confirmed with latest stable versions (rails 7.1.3.2, administrate 0.20.1), full trace:

rails generate administrate:install
[WARNING] Could not load generator "generators/administrate/install/install_generator". Error: uninitialized constant ActionCable.
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.5/app/channels/turbo/streams_channel.rb:34:in `<main>'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:26:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:135:in `cget'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:175:in `block in actual_eager_load_dir'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:25:in `each'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:25:in `ls'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:170:in `actual_eager_load_dir'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:16:in `each'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader.rb:379:in `block in eager_load_all'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader.rb:377:in `each'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader.rb:377:in `eager_load_all'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/administrate-0.20.1/lib/generators/administrate/install/install_generator.rb:2:in `<main>'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/behavior.rb:44:in `block (2 levels) in lookup'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/behavior.rb:40:in `each'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/behavior.rb:40:in `block in lookup'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/behavior.rb:39:in `each'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/behavior.rb:39:in `lookup'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/generators.rb:243:in `find_by_namespace'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/generators.rb:259:in `invoke'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/commands/generate/generate_command.rb:26:in `perform'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/base.rb:178:in `invoke_command'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/base.rb:73:in `perform'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:71:in `block in invoke'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:149:in `with_argv'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:69:in `invoke'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
/Users/nami/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bin/rails:4:in `<main>'
Could not find generator 'administrate:install'. (Rails::Command::CorrectableNameError)
Did you mean?  administrate:views
Run `bin/rails generate --help` for more options.

@dbelling
Copy link

dbelling commented May 8, 2024

This workaround in hotwired/turbo-rails#601 might be helpful?

@pablobm
Copy link
Collaborator

pablobm commented Jul 19, 2024

I can't reproduce 🤔 This is what I tried:

$ rails new --skip-action-cable no_action_cable
$ cd no_action_cable
$ bundle add administrate
$ ./bin/rails generate model thing name code amount:integer
$ ./bin/rails db:migrate
$ ./bin/rails generate administrate:install

The gem versions are as you list:

$ cat Gemfile.lock | grep -E '^    (rails|administrate) \('
    administrate (0.20.1)
    rails (7.1.3.4)

Is there something else in you app that I might be missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug breakages in functionality that is implemented
Projects
None yet
Development

No branches or pull requests

4 participants