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

undefined_method 'helper_method' for ActionController::Base #9

Open
nzifnab opened this issue Apr 16, 2024 · 0 comments · May be fixed by #10
Open

undefined_method 'helper_method' for ActionController::Base #9

nzifnab opened this issue Apr 16, 2024 · 0 comments · May be fixed by #10

Comments

@nzifnab
Copy link

nzifnab commented Apr 16, 2024

I'm using Mission Control for a UI into my active job backend (solid queue).

There's an option in mission control to set the Admin Controller via: MissionControl::Jobs.base_controller_class = "AdminController" which I am doing in config/initializers/mission_control.rb.

The controller in question is very simple:

class AdminController < ActionController::Base
  http_basic_authenticate_with name: Rails.application.credentials.admin.name, password: Rails.application.credentials.admin.password if Rails.env.production?
end

But when I have ultimate_turbo_model-rails installed, I get this error when trying to do anything (starting the server, rake task, generating a model, etc etc):

/home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/ultimate_turbo_modal-1.6.1/lib/ultimate_turbo_modal/helpers/controller_helper.rb:12:in `block in <module:ControllerHelper>': undefined method `helper_method' for ActionController::API:Class (NoMethodError)

      helper_method :inside_modal?
      ^^^^^^^^^^^^^
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/concern.rb:138:in `class_eval'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/concern.rb:138:in `append_features'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/ultimate_turbo_modal-1.6.1/lib/ultimate_turbo_modal/railtie.rb:13:in `include'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/ultimate_turbo_modal-1.6.1/lib/ultimate_turbo_modal/railtie.rb:13:in `block (2 levels) in <class:Railtie>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/api.rb:150:in `<class:API>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/api.rb:91:in `<module:ActionController>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/api.rb:7:in `<main>'
        from <internal:/home/zifnab/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/home/zifnab/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/draper-4.0.2/lib/draper.rb:39:in `block in setup_action_controller'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/draper-4.0.2/lib/draper.rb:38:in `class_eval'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/draper-4.0.2/lib/draper.rb:38:in `setup_action_controller'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/draper-4.0.2/lib/draper/railtie.rb:25:in `block (2 levels) in <class:Railtie>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/base.rb:258:in `<class:Base>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/base.rb:169:in `<module:ActionController>'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.1.3.2/lib/action_controller/base.rb:7:in `<main>'
        from <internal:/home/zifnab/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/home/zifnab/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /home/zifnab/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
        from /home/zifnab/projects/lawgical/processservers/app/controllers/admin_controller.rb:2:in `<main>'

There's more after that, but I truncated the trace at the point where it points at my mission control's admin_controller.

When I remove this controller temporarily, I can start the server, but then when I go to localhost:3000 to view it, I get the same error, but now in my main application's controller trying to inherit from ApplicationController. If I reload the page after this first error, it works fine.

Something is very goofy with how you're including that helper class...

@nzifnab nzifnab linked a pull request Apr 16, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant