I new to rails. I have a setup in the lib directory like so:
lib/
blog/
core/
search/
base.rb
The base.rb defin
I had the same issue. The problem was because I was including subdirs without including their parent lib dir:
# did not work
config.autoload_paths += %W(#{config.root}/lib/foo)
and
# in lib/foo/my_class.rb
module Foo
class MyClass
end
end
Foo::MyClass would return Expected to define MyClass
adding the lib dir to config.autoload_paths fixes the problem
# worked
config.autoload_paths += %W(#{config.root}/lib #{config.root}/lib/foo)