I recently upgraded my rails application to rails 7 and after upgrading when I try to call the call from the lib folder I am getting this error NameError (uninitialized constant Error)
I have following file structure in the lib folder
lib
-> a
-> b
-> c
-> d
-> error
-> test_errors.rb
whenver I call Error::TestErrors
I got this error, I guess this error is something related to the Zeitwerk
Can someone please help me with this
whenver I call Error::TestErrors
I got this error ideally this should work and as it is working on the another branch
lib
has not autoloaded by default in Rails since Rails 3. You either should require this code explicitly, move the code to/app
which is autoloaded or addlib
to the autoloading paths (not recommended). guides.rubyonrails.org/… – Tappetlib
in the autoload paths? You can inspectActiveSupport::Dependencies.autoload_paths
in a console, for example. What is "the other branch"? – Bisonlib
folder is present inActiveSupport::Dependencies.autoload_paths
– HistoryError::TestErrors
raises, is it referenced in an initializer? – BisonNameError
. Does that happen in an initializer? – BisonNameError
being raised from an initializer? I wonder if you are hitting guides.rubyonrails.org/…. – Bison