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.
以下方式完美运行
require "#{Rails.root}/lib/mymodule/class1.rb"
但是我为什么要放#{Rails.root}
#{Rails.root}
从 Ruby 2.0 开始,Ruby 不再认为当前目录位于 require 路径中。你也可以使用require ./lib/mymodule/class1.rb.
require ./lib/mymodule/class1.rb