2017-05-04 170 views
-1

Ajax用于Bootstrap模态调用。 js.erb文件被成功调用,然后该js.erb文件应加载html.erbjs.erb位于biz_workflowz/app/views/application/下相同的子目录中。这里是js.erb文件:RAILS 4.2:渲染中缺少模板:文件存在时调用ajax文件

$("#newworkflow .modal-content").html('<%= j render(:file => "/biz_workflowx/application/event_action.html.erb") %>'); 
$("#newworkflow").modal(); 

然而event_action.html.erb从未发现。该错误是成长在action_view/path_sets.rb

def find(*args) 
    find_all(*args).first || raise(MissingTemplate.new(self, *args)) #find_all(*args).first returns NIL 
end 

的错误是:

ActionView::Template::Error (Missing template c:/d/code/rails_proj/engines/biz_workflowx/app/views/application/event_action.html.erb with {:locale=>[:en], :formats=>[:js, :html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee]}. Searched in: 
    ....... 
     * "C:/D/code/rails_proj/engines/biz_workflowx/app/views" #<<== did search the subdir but did not find anything 
     * "C:/D/code/rails_proj/engines/searchx/app/views" 
     * "C:/D/code/rails_proj/engines/commonx/app/views" 
     * "C:/D/code/rails_proj/engines/authentify/app/views" 
     * "C:/D/code/rails_proj/webportal" 
     * "C:/" 
    ): 
     1: $("#newworkflow .modal-content").html('<%= j render(:file => "biz_workflowx/application/event_action.html.erb") %>'); 
     2: $("#newworkflow").modal(); 
     actionview (4.2.0) lib/action_view/path_set.rb:46:in `find' 

即使硬编码文件的路径event_action.html.erb,它仍然会返回template missing。类似的js.erb代码已经在一些地方用于ajax调用,我不明白为什么它不起作用。什么可能导致这个错误?谢谢。

更新:

下面是该biz_workflowz/app/views已经搜查resolver不看/application/下的文件中的调试窗口。奇怪!

enter image description here enter image description here

回答

0

添加c:/d/code/rails_proj/engines/biz_workflowx/app/views/application

+0

event_action.html.erb文件的文件已经存在 – user938363