rails 将布局呈现为文件(不是部分)

rails render layout as file (not partial)

我需要做以下事情:

render partial: 'my_partial', layout: 'my_layout'

但本例中的布局是一个视图,而不是部分视图。 我在以下位置定义了一个布局:

app/views/layouts/participant.html.haml # view

但是 Rails 正在寻找

app/views/layouts/_participant.html.haml # partial

我试过完整路径

render partial: 'my_partial', layout: 'full_path/to/my_layout'

但它仍然在寻找部分。

我该怎么做?

我从未使用过它,但你可以试试:

render file: '/path_to/my_view', layout: true

Docs here.