Ruby 方法范围如何工作?
我使用sinatra,有一个问题无法解决,代码如下:
require 'sinatra'
def url(s)
get s do yield end
post s do yield end
end
url '/' do
erb :index
end
那么,程序提示: undefined method `erb' for main:Object
怎么办?
I use sinatra, and have a question that I can't solve, here is the code:
require 'sinatra'
def url(s)
get s do yield end
post s do yield end
end
url '/' do
erb :index
end
then, the program tips that: undefined method `erb' for main:Object
what should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试这样的事情:
You could try something like this:
您可能想看看 Sinatra Multiroute。
You might want to take a look at Sinatra Multiroute.