Reputation: 607
As titled, I'm getting a NameError (uninitialized constant Workflow::Task)
for a model defined at app/models/workflow/task.rb
.
I'm confident the model definition is correct because it works 90% of the time, but 10% of the time I get this name error and it crashes. I cannot reproduce locally, this only happens in prod, where we use an Amazon Aurora DB. Could this occur if there are issues connecting to the database or something along those lines? Any pointers are appreciated
Using rails 5.1.6.2
Upvotes: 0
Views: 1348
Reputation: 106
It is clear from the error message that this is not a DB related issue. Put simply, Rails is not loading your model class.
You could try the following:
module Workflow; class Task
.config/application.rb
: config.autoload_paths << Rails.root.join('app/models/workflow')
app
directory.`
Upvotes: 2