我正在为我的投资组合制作一个简单的Sinatra静态网站。Sinatra - 制作嵌套的URL?
我想/profile
下几页像/profile/history
和/profile/education
通过下面的官方文档,我可以做到这一点:
get "/profile/history" do
...
end
get "/profile/education" do
...
end
它变得多余。有没有DRY这样做?也许增加一个class
什么的?
感谢
完美!如何调用模板?该模板位于'/ profile'子目录中,并将其称为我使用'erb:'profile/history''。任何避免写入子目录的方法?再次感谢 – hrsetyono
似乎'Sinatra :: Namespace'不知道模板子目录。你尝试过'erb:history'吗? – davogones
我试过'erb:history',它不起作用。我必须指定子目录'erb:'profile/history''。那就够了。非常感谢 – hrsetyono