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 ./lib/mymodule/class1.rb。
require ./lib/mymodule/class1.rb