<% @user = MarkupUser.new %>
<% form_for @user, '/demo1', id: 'demo-fields-for' do |f| %>
  <%= f.text_field :gender %>
  <% fields_for @user.permission do |permission| %>
    <%= permission.check_box :can_edit %>
    <%= permission.check_box :can_delete %>
  <% end %>
  <% f.fields_for :telephone do |child_form| %>
    <%= child_form.label :number %>
    <%= child_form.text_field :number %>
  <% end %>
  <% f.fields_for :addresses do |child_form| %>
    <%= child_form.label :name %>
    <%= child_form.text_field :name %>
    <% unless child_form.object.new_record? %>
      <%= child_form.check_box '_destroy' %>
      <%= child_form.label '_destroy', caption: 'Remove' %>
    <% end %>
  <% end %>
<% end %>
