Recursively including all model subdirectories
问题 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: this should be helpful Dir["#{config.root}/app/models/**/","#{config.root}/lib/**/"] enjoy! (: Update: Excellent question, posting example above i have simply referred