Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:44:26+00:00 2026-06-05T13:44:26+00:00

I new to rails. I have a setup in the lib directory like so:

  • 0

I new to rails. I have a setup in the lib directory like so:

lib/
   blog/
     core/
        search/
            base.rb

The base.rb defines the Base class as well:

module Blog
  module Core
    module Search
      class Base

        attr_accessor :properties

        def initialize(params)
          @properties = {}
        end
      end
    end
  end
end

I have the following code in my application.rb

config.autoload_paths += Dir["#{config.root}/lib/**/"]

When I include it in posts controller I get following errors:

LoadError in PostsController#index

Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base

Any idea? I’m using rails 3.2.5 with RVM. Thank you for every advice.

UPDATED: Added my full stack:

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 `<top (required)>'
  app/controllers/admin/posts_controller.rb:6:in `<top (required)>'


  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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:44:28+00:00Added an answer on June 5, 2026 at 1:44 pm

    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/**/"]
    

    Here are the changes I made to make it work

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a setup in the lib directory like so: lib/ copy_process.rb copy_process/ processor.rb
Starting a new rails project and we have a well-thought-out color palette, and want
I'm new to rails. I have my controller and view setup. When I view
I'm new to Rails. I have two models, Person and Day. class Person <
I'm new to rails and have volunteered to help out the local High School
I am new to rails and have developed a simple rails application on my
I am fairly new to Rails and I have never developed a large application.
I am new to Rails routing and I currently have a problem and hope
I am new to Rails and Linux and have installed RVM with sudo. sudo
I am new to rails validation. I have two fields: field :feed_entitlements, :type =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.