Ajax用于Bootstrap模式调用。成功调用js.erb
文件,然后此js.erb
文件应加载html.erb
驻留在与js.erb
位于biz_workflowz/app/views/application/
下的同一子目录中。这是js.erb
文件:
$("#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/
下未看到该文件。奇怪!
答案 0 :(得分:0)
在event_action.html.erb
c:/d/code/rails_proj/engines/biz_workflowx/app/views/application
个文件