1
我们遇到了Rails ActionController :: Base.view_paths的问题。我们正在运行多租户应用程序,并为每个租户提供不同的主题。现在我们有一个问题,即主题view_paths不会在每个请求上重置,而是在控制器中使用prepend_view_path时进行堆叠。跨请求共享Rails view_paths
@paths=
[
...
@path="/app/themes/theme2/views",
...
@path="/app/themes/theme1/views",
]
我们在控制器使用
ActionController::Base.prepend_view_path "app/themes/#{Theme.current}/views/"
。
您知道我们如何强制rails在每个请求上生成新的view_paths吗?