Search code examples
ruby-on-railsinitializationdirectory-structure

Autoloading files in subfolders to helpers


I want to organize some helpers in subfolders in the helpers directory. 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? }

Solution

  • You should simply add this to your application.rb file.