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.
精彩评论