w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
rails - require single file works, but require all of directory not

You have to skip . and .., which are entries of a directory listing. You might also want tn check if the entry is a directory and skip them as well:

Dir[Rails.root.join('lib/railsadmin_custom_functions')].each do
  next if File.directory?(file)
  require file

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.