Reputation: 31
I recently upgraded an old ruby app from rails 5 to rails 7. Ever since, I have been getting this error. It happens after I run rails s and access the application through the browser (seems like the application builds successfully, I only get the error after loading the web App). The constant referred to is defined as such in app\models\faculty_w\v1\appointment.rb
:
class FacultyW::V1::Appointment
include ActiveModel::Validations
include AppointmentCommon
include Swagger::Blocks
include SwaggerSchemas
Anyone have any suggestions?
NameError (uninitialized constant FacultyW::V1::Appointment::SwaggerSchemas):
app/models/faculty_w/v1/appointment.rb:5:in `<class:Appointment>'
app/models/faculty_w/v1/appointment.rb:1:in `<top (required)>'
app/controllers/apidocs_controller.rb:47:in `<class:ApidocsController>'
app/controllers/apidocs_controller.rb:1:in `<top (required)>'
I also tried running zeitwerk:check but I get the same error and no recommendations on how to fix it.
I figured it had something to do with the new autoloader but whenever I add the path to the autoloader in application.rb using config.eager_load_paths += %W(#{config.root}/app/models/faculty_w/v1)
and config.autoload_paths += %W(#{config.root}/app/models/faculty_w/v1)
I still get the second half of this error.
I also added config.autoloader = :classic
to application.rb but that did not change anything
Upvotes: 0
Views: 62