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

Upgrading to Zeitwerk: uninitialized constant ForestLiana::SmartActionsController (NameError) #425

Open
YoranBrondsema opened this issue Feb 17, 2021 · 0 comments

Comments

@YoranBrondsema
Copy link
Contributor

I'm upgrading our project to Zeitwerk. We have smart actions defined in controllers in app/controllers/forest, e.g.:

# app/controllers/forest/users_controller.rb

class Forest::UsersController < ForestLiana::SmartActionsController
  def some_smart_action
    ...
  end
end

Expected behavior

I expect the local development to start and run without any errors.

Actual behavior

When starting the server in local development, i.e. bundle exec rails s, it fails with:

/Users/yoran/Projects/Sutori/sutori/backend/app/controllers/forest/users_controller.rb:3:in `<main>': uninitialized constant ForestLiana::SmartActionsController (NameError)

Failure Logs

Here is the complete failure log:

~/Projects/Sutori/sutori/backend $ bundle exec rails s
=> Booting Puma
=> Rails 6.0.3.5 application starting in development
=> Run `rails server --help` for more startup options
**************************************************
⛔️ WARNING: Sidekiq testing API enabled, but this is not the test environment.  Your jobs will not go to Redis.
**************************************************
W, [2021-02-17T14:23:56.110852 #37507]  WARN -- : Creating scope :open. Overwriting existing method Subscription.open.
/Users/yoran/Projects/Sutori/sutori/backend/app/mailers/concerns/mailable.rb:7: warning: already initialized constant Mailable::INTERNAL_EMAILS
/Users/yoran/Projects/Sutori/sutori/backend/app/mailers/concerns/mailable.rb:7: warning: previous definition of INTERNAL_EMAILS was here
/Users/yoran/Projects/Sutori/sutori/backend/app/mailers/concerns/mailable.rb:8: warning: already initialized constant Mailable::LIST_NAME
/Users/yoran/Projects/Sutori/sutori/backend/app/mailers/concerns/mailable.rb:8: warning: previous definition of LIST_NAME was here
Exiting
Traceback (most recent call last):
        90: from bin/rails:4:in `<main>'
        89: from bin/rails:4:in `load'
        88: from /Users/yoran/Projects/Sutori/sutori/backend/bin/spring:15:in `<top (required)>'
        87: from /Users/yoran/Projects/Sutori/sutori/backend/bin/spring:15:in `require'
        86: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        85: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
        84: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
        83: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
        82: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
        81: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
        80: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'                                                                                                                                                  [54/7865]
        79: from /Users/yoran/Projects/Sutori/sutori/backend/bin/rails:11:in `<top (required)>'
        78: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:324:in `require'
        77: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:291:in `load_dependency'
        76: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:324:in `block in require'
        75: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        74: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        73: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        72: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        71: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        70: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands.rb:18:in `<main>'
        69: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/command.rb:46:in `invoke'
        68: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/command/base.rb:69:in `perform'
        67: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        66: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        65: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        64: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands/server/server_command.rb:138:in `perform'
        63: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands/server/server_command.rb:138:in `tap'
        62: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands/server/server_command.rb:147:in `block in perform'
        61: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands/server/server_command.rb:37:in `start'
        60: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
        59: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
        58: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
        57: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
        56: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
        55: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
        54: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
        53: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'                                                                                                                                                          [27/7865]
        52: from config.ru:4:in `block in <main>'
        51: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:324:in `require'
        50: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:291:in `load_dependency'
        49: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/dependencies.rb:324:in `block in require'
        48: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
        47: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        46: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        45: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        44: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        43: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        42: from /Users/yoran/Projects/Sutori/sutori/backend/config/environment.rb:7:in `<main>'
        41: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/application.rb:363:in `initialize!'
        40: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/initializable.rb:60:in `run_initializers'
        39: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
        38: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
        37: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
        36: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `call'
        35: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `each'
        34: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
        33: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
        32: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        31: from /Users/yoran/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
        30: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/initializable.rb:61:in `block in run_initializers'
        29: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/initializable.rb:32:in `run'
        28: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/initializable.rb:32:in `instance_exec'
        27: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/application/finisher.rb:129:in `block in <module:Finisher>'
        26: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
        25: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:51:in `each'
        24: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
        23: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
        22: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
        21: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/activesupport-6.0.3.5/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook'
        20: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/forest_liana-5.4.3/lib/forest_liana/engine.rb:73:in `block in <class:Engine>'
        19: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/railtie.rb:190:in `method_missing'
        18: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/railties-6.0.3.5/lib/rails/railtie.rb:190:in `public_send'
        17: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/forest_liana-5.4.3/lib/forest_liana/engine.rb:61:in `eager_load_active_record_descendants'
        16: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:508:in `eager_load_all'
        15: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:508:in `each'
        14: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:393:in `eager_load'
        13: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:393:in `synchronize'
        12: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:404:in `block in eager_load'
        11: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:725:in `ls'
        10: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:725:in `foreach'
         9: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:733:in `block in ls'
         8: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:409:in `block (2 levels) in eager_load'
         7: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:409:in `const_get'
         6: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:26:in `require'
         5: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
         4: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
         3: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
         2: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
         1: from /Users/yoran/.rvm/gems/ruby-2.7.2@sutori/gems/bootsnap-1.6.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/yoran/Projects/Sutori/sutori/backend/app/controllers/forest/users_controller.rb:3:in `<main>': uninitialized constant ForestLiana::SmartActionsController (NameError)

Context

  • Package Version: 5.4.3
  • Rails Version: 6.0.3.5
  • Database Dialect: PostgreSQL
  • Database Version: 13.1
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

1 participant