我想在共享的局部布局form
中显示form_layout
局部
# views/layouts/shared/_form_layout.html.haml
= form_with(model: record, remote: true) do |form|
.fields
= yield
/// other stuff
# views/articles/_form.html.haml
# ?? want to access the form builder here
# views/articles/new.html.haml
= render partial: 'form', layout: 'layouts/shared/form_layout', locals: { record: Article.new }
如何访问部分模板内的FormBuilder
对象?
答案 0 :(得分:0)
您应该尝试此操作
= render layout: "layouts/shared/form_layout", locals: { record: Article.new} do
# block contents..