0
我想使用一个自定义模板文件,它使用Rails金属代码中的基本布局文件(app/view/layouts/application.html.erb)。有人可以给我一些提示,我需要什么或我该怎么做?如何在导轨金属中渲染?
我想使用一个自定义模板文件,它使用Rails金属代码中的基本布局文件(app/view/layouts/application.html.erb)。有人可以给我一些提示,我需要什么或我该怎么做?如何在导轨金属中渲染?
require 'erb'
class Poller # in metal
def self.call(env)
# can find abs path using File.dirname(__FILE__)/../app/...
view = IO.read(`/absolute/path/app/view/layouts/application.html.erb`)
template = ERB.new(view)
body = template.result(binding)
[200, {"Content-Type" => "text/html"}, body]
end
end
非常感谢你:) – xaver23 2010-03-17 09:46:34