Ask A Question

Notifications

You’re not receiving notifications from this thread.

Zeitwerk causing issues while loading passwords_controller.rb file

codetoprogramsomethingmeaningful asked in Gems / Libraries

Hey everyone, if i may get a little help, i have recently added a file under controller section of my webapp, and from that time this is causing some issues as such :

Exiting
root@DESKTOP-MI3GRH3:/mnt/c/bckp/Railsapp/scheduled_tweets_flash# C
root@DESKTOP-MI3GRH3:/mnt/c/bckp/Railsapp/scheduled_tweets_flash# rails s
=> Booting Puma
=> Rails 7.0.7 application starting in development
=> Run bin/rails server --help for more startup options
Exiting
/root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:171:in `rescue in cname_for': wrong constant name PasswordsController inferred by Module from file (Zeitwerk::NameError)

/mnt/c/bckp/Railsapp/scheduled_tweets_flash/app/controllers/passwords_controller .rb

Possible ways to address this:

  • Tell Zeitwerk to ignore this particular file.
  • Tell Zeitwerk to ignore one of its parent directories.
  • Rename the file to comply with the naming conventions.
  • Modify the inflector to handle this case.

    raise Zeitwerk::NameError.new(<<~MESSAGE, error.name)
    ^
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:166:in cname_for'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:414:in
    block in set_autoloads_in_dir'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:40:in block in ls'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:25:in
    each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:25:in ls'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:411:in
    set_autoloads_in_dir'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:124:in block (2 levels) in setup'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:123:in
    each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:123:in block in setup'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:120:in
    synchronize'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader.rb:120:in setup'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/application/finisher.rb:40:in
    block in module:Finisher'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in instance_exec'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in
    run'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/initializable.rb:61:in block in run_initializers'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:228:in
    block in tsort_each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:431:in
    each_strongly_connected_component_from'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:349:in block in each_strongly_connected_component'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in
    each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in call'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in
    each_strongly_connected_component'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:226:in tsort_each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/tsort.rb:205:in
    tsort_each'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/initializable.rb:60:in run_initializers'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/application.rb:372:in
    initialize!'
    from /mnt/c/bckp/Railsapp/scheduled_tweets_flash/config/environment.rb:5:in <main>'
    from config.ru:3:in
    require_relative'
    from config.ru:3:in block in <main>'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in
    eval'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in new_from_string'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in
    load_file'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in parse_file'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/server.rb:349:in
    build_app_and_options_from_config'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/server.rb:249:in app'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/server.rb:422:in
    wrapped_app'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:76:in log_to_stdout'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:36:in
    start'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:143:in block in perform'
    from <internal:kernel>:90:in
    tap'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:134:in perform'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in
    run'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in invoke_command'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in
    dispatch'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/command/base.rb:87:in perform'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/command.rb:48:in
    invoke'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.7/lib/rails/commands.rb:18:in <main>'
    from <internal:/root/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in
    require'
    from internal:/root/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:38:in require'
    from /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
    require'
    from bin/rails:4:in <main>'
    /root/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.11/lib/zeitwerk/loader/helpers.rb:167:in
    const_defined?': wrong constant name PasswordsController (NameError)

    CNAME_VALIDATOR.const_defined?(cname, false)

Can someone be able to diagnose and help me get through this ?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.