我有 rails 应用程序,其中我已经命名了所有需要的模块。模块没有加载和获取Name error Uninitialised constant Udp
/app/adapters/Udp/ #Here Udp is the module name
包含两个文件。
第一个.rb
module Udp
class First #First is the class name
def self.first_ac
"first"
end
end
end
sec.rb
module Udp
class Sec
def self.sec_ac
"sec"
end
end
end
配置/应用程序.rb
config.autoload_paths += Dir["#{config.root}/app/adapters/**/*"]
我正在尝试访问:Articles_controller
def index
msg = Article.invite
render text: msg
end
文章.rb
def self.invite
msg = Udp::First.first_ac
msg
end
请帮我解决它。