title: Expected to define. When calling class inside a module
body: <p>I new to rails. I have a setup in the lib directory like so:</p>
  
  <pre><code>lib/
     blog/
       core/
          search/
              base.rb
  </code></pre>
  
  <p>The base.rb defines the Base class as well:</p>
  
  <pre><code>module Blog
    module Core
      module Search
        class Base
  
          attr_accessor :properties
  
          def initialize(params)
            @properties = {}
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>I have the following code in my application.rb</p>
  
  <pre><code>config.autoload_paths += Dir["#{config.root}/lib/**/"]
  </code></pre>
  
  <p>When I include it in posts controller I get following errors:</p>
  
  <pre><code>LoadError in PostsController#index
  
  Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base
  </code></pre>
  
  <p>Any idea? I'm using rails 3.2.5 with RVM. Thank you for every advice.</p>
  
  <p><strong>UPDATED:</strong> Added my full stack:</p>
  
  <pre><code>Started GET "/admin/posts" for 127.0.0.1 at 2012-06-08 21:06:18 +0800
  
  LoadError (Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base):
    app/controllers/admin/base_controller.rb:5:in `&lt;top (required)&gt;'
    app/controllers/admin/posts_controller.rb:6:in `&lt;top (required)&gt;'
  
  
    Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194@rails-3.2.5/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.9ms)
    Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194@rails-3.2.5/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
    Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194@rails-3.2.5/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.0ms)
  </code></pre>