开发者

Nested model forms; How to access the parent/root FormBuilder?

I have the following rails erb code:

<% form_for @foo do |c| %>
  <% c.fields_for :bars do |builder| %>
  <%= render 'foo/bar_fields', :f => builder %>
  <% end %>
<% end %>

Inside the _bar_fields.erb partial I can access the FormBuilder of the nested model through the 'f' instance variable. Is there a way to access the 'parent'/'root' FormBuilder through that instance variable? Or is passing another local to the partial the only way开发者_StackOverflow?


As far as I know you'd have to pass it through as another local.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜