使用rails3 - 我有一个包含许多任务的项目。我想使用JavaScript为每个任务构建UI。我想我可以在项目展示页面上显示这些任务,为每个呈现一个javascript部分。我无法获得'tasks/show'来查看tasks/show.js.erb是否有任何想法?如何在rails中渲染partial.js 3
在项目/ show.html.erb
<div id="tasks">
<%= render(:partial => "tasks/show", :collection => @project.tasks) %>
</div>
任务/ show.js.erb
$("tasks").append(new TaskWidget(task.id))
我得到的错误
ActionView::MissingTemplate in Projects#show
Missing partial tasks/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths .... around line #13
感谢
不知道,但尝试:<%=渲染(:部分=>“任务/ show.js“,:collection => @project.tasks)%> – fig 2010-05-02 23:07:24
谢谢,但不幸的是我得到了同样的结果:缺少部分任务/show.js – 2010-05-02 23:15:43