ruby on rails - How do I call my namespaced class from the lib directory -
i have class that's 3 levels deep in lib directory i'm trying call uninitialized constant error. class , directory structure looks this:
file name: lib/my_module/my_second_module/my_third_module/my_class.rb
module my_module module my_second_module module my_third_module class my_class def self.something something... end end end end end
i'm trying call class using rails console returns 'uninitialized constant my_module'. run command , error:
mymodule::mysecondmodule::mythirdmodule::myclass.something
also i've include following in config/application.rb
config.autoload_paths += dir["#{config.root}/lib/my_module/**/"]
try ::mymodule::mysecondmodule::mythirdmodule::myclass.something
Comments
Post a Comment