我有一个方法,使一堆变量和结束调用渲染部分…
def add_shift
...
render :partial => 'assignments/edit'
end
但是当这个页面试图渲染它给我这个粗糙的错误…
Missing partial volunteer_events/_editform_perfect, application/_editform_perfect with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
* "/home/fonso/back-expirement/app/views"
这是break视图的代码…
<div class="modal fade" id="edit_event">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<div class="col-sm-8 left border-right">
<h4 class="modal-title">Edit Assignment</h4>
</div>
<div class="col-sm-4 right d-flex flex-row">
<h4 class="modal-title">Who's Working</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
<%= render 'editform_perfect', assignment: @assignment %>
</div>
</div>
</div>
部分是位于assignments/_edit.html和作业/_editform_perfect
为什么我得到这个有趣的错误,我如何修复它,让我看到偏导数?
从错误消息来看,您似乎正在从控制器volunteer_events_controller
呈现视图。因此,当您尝试渲染部分editform_perfect
时,它将默认在views/volunteer_events/
目录中查找。
您需要在视图中提供部分的路径。
<%= render partial: 'assignments/editform_perfect'.... %>