Reputation: 546
I have a namespaced route and here's how I created the controller:
module A
module B
module Test
class DummyController < ApplicationController
def quantify_stocks
something = Test::Dummy::Something.new(params)
# more code here
end
end
end
end
end
I am trying to access the class Test::Dummy::Something
but it autoloads the constant Test with A and B (A::B::Test
)?
The error I get is:
NameError (uninitialized constant A::B::Test::Dummy)
Upvotes: 3
Views: 587
Reputation: 12700
Try ::Test::Dummy::Something
Test
in this context will always refer to A::B::Test
so you need to say explicitly that you need Test
from the global namespace, which is exactly what ::Test
does
Upvotes: 5