Skip to content

Instantly share code, notes, and snippets.

@zacclark
Created August 5, 2010 19:24
Show Gist options
  • Save zacclark/510241 to your computer and use it in GitHub Desktop.
Save zacclark/510241 to your computer and use it in GitHub Desktop.
<% @person.current_employments.each do |emp| %>
<% f.fields_for :employments, emp do |em| %>
<%= em.hidden_field :id %>
<% em.fields_for :company, emp.company do |co| %>
<%= co.hidden_field :id %>
<% co.fields_for :special_dataset do |cd| %>
<%= cd.hidden_field :id %>
<% em.fields_for :postal_address do |pa| %>
<% em.fields_for :assistant, emp.assistant do |ast| %>
more of the form in here
Q: Can this be cleaned up?
In most situations it could be cleaner by surrounding the
specific nested fields in their fields_for calls, but the
form is segmented (in terms of models) so that these occur
all over the place, but need to share the same formbuilder
object, so I can only call each fields_for once.
<%
# ending all of the nested fields
end ; end ; end ; end ; end
%>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment