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 6696771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:22:50+00:00 2026-05-26T06:22:50+00:00

How do you load all directories recursively in the models and lib directories? In

  • 0

How do you load all directories recursively in the models and lib directories? In application.rb, I have the lines:

config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
config.autoload_paths += Dir[Rails.root.join('lib', '{**}')]

but they only seem to add one level of model and lib subdirectories.

Thanks

  • 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-05-26T06:22:51+00:00Added an answer on May 26, 2026 at 6:22 am

    this should be helpful

     Dir["#{config.root}/app/models/**/","#{config.root}/lib/**/"]
    

    enjoy! (:

    Update:

    Excellent question, posting example above i have simply referred to my recent project.

    After making some tests, better understanding comes to me and it is great.

    The main difference is of course neither in join method of File not config.root / Rails.root

    Trailing ‘/’ after ‘**’ makes sense.

    First one talks to match only directories when globbing.
    Second one talks do it recursively.

    In your case this one could be also appropriate

    Dir[ Rails.root.join('app', 'models', '**/') ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to load a config file and read all the values
In my Silverlight application, I load all the images I need at application start
I change schema.yml from time to time and execute: symfony propel:build-all-load but the lib/_model
I'm trying to load text of all divs that have a particular class into
I have an MVC application that consists of a directory with all the necessary
I am trying to load all my Neo4j DB to the RAM so querying
In Python 2.7, when I load all data from a text file of 2.5GB
I am using the below code in my test class , to load all
How to write custom web service load test: All my web services has byte[]
I currently create an object on page load with all possible key/value pairs and

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.