[英]Autoloading files in subfolders to helpers
I want to organize some helpers in subfolders in the helpers directory. 我想在helpers目录的子文件夹中组织一些助手。 I figured adding this in the initializer would do the trick, but not luck: 我想在初始化器中添加它可以解决问题,但不走运:
config.autoload_paths += Dir["#{RAILS_ROOT}/app/helpers/*"].find_all { |f| File.stat(f).directory? }
您只需将其添加到application.rb
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.