I would like to know what is the right way to use a class with namespace in rails 6. I have the follow, but it isn't working and I'm receiving the error:
"Uninitialized constant ProductsController::Operations Did you mean? ProductsController::Options"
#app/operations/create.rb
module Operations
class Create
def self.foo
...
end
end
end
#app/controllers/products_controller.rb
class ProductsController < ApplicationController
def create
Operations::Create.foo
end
end
Can you help me please?
app/modules/operations/create.rb. You can swap outmodulesfor really anything you like