Hi,
I'm getting an uninitialized constant error in a name spaced controller (controllers/api/mobile).
I have two workers:
app/workers/ExtractionWorker
app/workers/CopyWasabiObject
I have two controllers:
App/controllers/photos_controller.rb
App/controllers/api/mobile/photos_controller.rb
The non name spaced controller makes a call to ExtractionWorker with no problems and performs the work and doesn't raise this error.
When an API request is sent to the `api/mobile/photos_controller.rb`, I get the following error:
NameError: uninitialized constant CopyWasabiObject
From the command line on production, I can instantiate the class with no issue
Loading production environment (Rails 6.0.2.1)
irb(main):001:0> CopyWasabiObject.new
=> #<CopyWasabiObject:0x0000557aa6e262f8>
app/controllers/photos_controller.rb
if @photo.save
ExtractionWorker.perform_async(wasabi_path(folder.uuid, photo_params[:name]), @photo.id)
...
end
works as expected
app/controllers/api/mobile/photos_controller.rb
def update
...
CopyWasabiObject.perform_async(@photo.uuid, raw_folder_uuid) if @photo.update!(merged_params)
end
works on dev but fails on production
Why does one worker work, while the other fails to load? I haven't touched auto loading in config/application.rb. Every file is under app/* and I am not using anything at the root like lib.
What I have tried recently and doesn't work.
I tried name spacing the works to match the paths. IE: workers/api/mobile
I tried moving all works into app/models/
I have changed the calls in the controllers to call class methods which then call the worker
No matter what I seem to try, I just get the NameError: uninitialized constant CopyWasabiObject
Any help would be appreciated!