鉴于a really simple Sinatra application:
require 'sinatra'
require 'slim/include'
get '/' do
@specifically = %W(milk bread cheese).sample
slim :home
end
views/home.slim
看起来像这样:
doctype html
html
head
title Don't forget the stuff
body
include reminder
我们可以看到reminder
被包含为一个单词(而不是String
)。
在views/reminder.slim
中,我想要包含变量@specifically
所代表的随机部分:
p Remember the things!
include @specifically
这会在Temple::FilterError
:/
处提出'@specifically.slim' not found
。
如何让Slim在这里呈现milk.slim
(或其他)?
答案 0 :(得分:0)