0

我在 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

这应该呈现位于 pmdocuments 中的名为 show.js.erb 的模板,但相反,我收到此错误消息:

ActionView::MissingTemplate (Missing template clips/pmdocuments/show,
application/pmdocuments/show with {:locale=>[:en], :formats=>[:js, :html]
, :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:

怎么了?

4

1 回答 1

3

添加前导/. 它试图呈现相对于当前控制器的动作。所以这 -

render action: "/pmdocuments/show"
于 2012-12-11T15:40:57.440 回答