I am currently porting an application in rails v2 to v3
In my lib/ I have some modules in subdirectories, for example, I have lib/search/host_search.rb
from
module HostSearch def do_search(args)
then I need to use it in a controller called Discovery::HostController < ApplicationController :
def search_results output = HostSearch.do_search(:search_string => @search_string, :page => params[:page], :user => @current_user)
But do I get:
uninitialized constant Discovery::HostController::HostSearch
.. I tried putting these lines in application.rb, but it does not work.
config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += Dir["#{config.root}/lib/**/"]
source share