Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Ruby 1.9.3 中遇到问题。这是我的文件结构
App |-- config |-- database_setup.rb |-- models |-- *.rb
我的 database_setup.rb 需要从模型文件夹中获取所有 rb 文件。我很难找到正确的目录。
你试过什么了?
你有没有尝试过:
Dir[File.join(File.dirname(__FILE__), '..', 'models', '**/*.rb')].sort.each do |file| require file end