在由幾個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?
看到它。如何讓渲染器看到它?謝謝。