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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.