我遇到了渲染部分问题:来自命名空间控制器。我应该能够从视图相对于views文件夹渲染任何部分,但是,我无法这样做。它将部分路径附加到命名空间,无论我做什么。该控制器响应ajax调用并返回html。
预期
1) render partial: "foos/bar" => "app/views/foos/_bar.html.haml"
2) render partial: "/foos/bar" => "app/views/foos/_bar.html.haml"
获得
1) render partial: "foos/bar" => "app/views/ajax_api/foos/_bar.html.haml"
2) render partial: "/foos/bar" => "app/views/ajax_api//foos/_bar.html.haml"
note on 2 extra "/"
我试过的结果并不重要
ActionView::Template::Error:
Missing partial 'insert above output'
路线
namespace :ajax_api do
resource :setup, only: [] do
post :selection, on: :member
post :deployment, on: :member
end
end
答案 0 :(得分:0)
因此,命名空间似乎优先于定义的路由,总是
然而,似乎添加了一个选项来关闭命名空间的前缀。 见:render partial of another namespace
我想我要重构我的路线,不要使用命名空间。
<强>讨论强>
定义路径中的前导斜杠应始终优先于命名空间?