我在clipsController中执行此代码:
def destroy
@clip = Clip.find(params[:id])
@clip.destroy
respond_to do |format|
format.html {redirect_to request.referer, notice: "Attachment deleted."}
format.js {
@pmdocument = @clip.attachable
render action: "pmdocuments/show"
}
end
end
这应该呈现一个名为show.js.erb的模板,位于pmdocuments中,但是我得到了这个错误信息:
ActionView::MissingTemplate (Missing template clips/pmdocuments/show,
application/pmdocuments/show with {:locale=>[:en], :formats=>[:js, :html]
, :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:
怎么了?
答案 0 :(得分:3)
添加前导/
。它试图渲染相对于当前控制器的动作。所以这个 -
render action: "/pmdocuments/show"