【发布时间】:2012-03-23 14:22:40
【问题描述】:
我想做这样的事情:
require 'erb'
@var = 'test'
template = ERB.new File.new("template.erb").read
rendered = template.result(binding())
但是如何在 template.erb 中使用局部变量?
【问题讨论】:
-
stackoverflow.com/a/2467313/772874 的可能重复项,您需要
ActionView。