在由几个Rails引擎组成的Rails 4.2应用程序中,需要引擎itemlized_spendingx
通过ajax调用来渲染引擎biz_workflowx
中的文件。发动机biz_workflowx
被包括在这样itemlized_spendingx
的应用控制器:Rails 4.2:如何渲染包含引擎中的文件?
module ItemlizedSpendingx
class ApplicationController < ::ApplicationController
include BizWorkflowx::WfHelper
end
end
在BizWorkflowx::WfHelper
,存在定义的动作event_action
它被称为AJAX与link_to
从索引视图中发动机itemlized_spendingx
。这里是event_action.js.erb
响应AJAX调用
$("#newworkflow .modal-content").html('<%= j render(:file => "biz_workflowx/application/event_action.html.erb") %>');
$("#newworkflow").modal();
上述evant_action.js.erb
的目的是弹出的event_action.html.erb
(一个视图都event_action.js.erb和event_action.html.erb驻留在相同的子目录下biz_workflowx /应用/ views/application /)与Bootstrap模态。我遇到的问题是即使File.file?('biz_workflows/app/views/application/event_action.html.erb
)在ActionView resolver
中返回true
,render(:file => ..)
也会产生template missing
的错误。
看起来render
真的很难找到event_action.html.erb
,即使File.file?
看到它。如何让渲染器看到它?谢谢。