# config/initializers/autoloading.rb
module Domains
end
Rails.autoloaders.main.push_dir(
"#{Rails.root}/app/domains",
namespace: Domains
)
# The next additional lines are necessary in Rails < 7.1.
domains_dir = "#{Rails.root}/app/domains" # has to be a string
ActiveSupport::Dependencies.autoload_paths.delete(domains_dir)
Rails.application.config.watchable_dirs[domains_dir] = [:rb]
1条答案
按热度按时间4zcjmb1e1#
可以通过以下方式实现: