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.
当我使用 erb 方法时:
require 'erb' def erb(template) path = File.expand_path("../views/#{template}", __FILE__) ERB.new(File.read(path)).result(binding) end
然后使用:
Rack::Response.new(erb('default.html.erb'))
它引发了一个 Errno::ENOENT。为什么是这样?谢谢!
看起来你可能弄错了文件路径。检查以确保这是正确的。