这似乎相当微不足道,但让我非常悲伤!
我在 lib 文件夹中有一个模块。
require 'net/http'
module Weather
def get_response
NET::HTTP.get_response(URI.parse 'someURL').body
end
end
控制器。
class SunController < ApplicationController
include Weather
def show
logger.debug get_response
end
end
配置/应用程序.rb
config.autoload_paths += %W(#{config.root}/lib)
我得到这个错误
uninitialized constant Weather::NET
我知道模块已正确加载。我究竟做错了什么?