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 problem. It comes from the fact that you try to load /lib/blog/core/search/base.rb directly in application.rb with /lib/**/
Error I had:
Expected /[...]/myapp/lib/durative/base.rb to define Base (LoadError)
Directory structure:
lib/
--durative/
--base.rb
base.rb:
module Durative
class Base
def initialize(config)
@config = {}
end
#...
end
end
application.rb:
config.autoload_paths += Dir["#{config.root}/lib/**/"]
Directory structure:
lib/
--durative.rb **(added)**
--durative/
--base.rb
durative.rb:
require 'durative/base'
base.rb (no change)
application.rb (changed):
config.autoload_paths += Dir["#{config.root}/lib/"]
Tell us if it worked for you too.