I m 目前在铁路中迁移申请2至3
In my lib/
i ve some modules in subdirectories, for example,
i ve the lib/search/host_search.rb
with a
module HostSearch
def do_search(args)
#...
end
end
then I need to use it in a controller named Discovery::HostController < ApplicationController :
def search_results
output = HostSearch.do_search(:search_string => @search_string,
:page => params[:page],
:user => @current_user)
#...
end
But have I get:
uninitialized constant Discovery::HostController::HostSearch
。 我试图将这条线付诸实施,但是它没有工作。
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]