【发布时间】:2012-01-03 09:10:35
【问题描述】:
我有以下文件:
#{RAILS_ROOT}/public/mytemplate/index.html
在一个带有某些类似模板的变量的 html 文件中,如下所示:
<div class="hover">
<h1 id="user_name">{user_name}</h1>
</div>
<h2 id="project_name">{project_name}</h2>
从一个控制器动作,我需要渲染这个文件,我正在使用它
render :file => "#{RAILS_ROOT}/public/mytemplate/index.html"
但我想将变量映射到模板值。例如,我想指定 @project.name 映射到 project_name。如何指定此映射?
【问题讨论】:
标签: templates jquery-templates ruby-on-rails-2