Reputation: 693
I have class called Configuration that is called in my controller. Instead of instantiating my Configuration class, it is trying to instantiate a ActiveSupport::Configurable::Configuration
.
How can I access my Configuration
class, named the same as another library's Configuration
?
class SampleController < ActionController::Base
def m1
cfg = Configuration.new
end
end
Upvotes: 0
Views: 45
Reputation: 160191
class SampleController < ActionController::Base
def m1
cfg = ::Configuration.new
end
end
I'd recommend putting your own classes in their own modules, though.
In addition to avoiding class name collisions like this, it provides a structure from which you can hang more of your own code.
Upvotes: 1