Multiple fields_for, same model

I have three fields_for inside a form_tag.

http://pastie.org/218918

Two of them, correspond to the same model, :customer, (the two
objects, billing_customer and shipping_customer have been built in the
controller method). When I submit the form, the parameters only
include one of the two fields_for methods and it comes through as the
model name, not the object name:

“customer”=>{…}

I know there is a way to use two fields_for sections that correspond
to the same model… what am I doing wrong here?

-Nik

Nik can you update mentioned URL with field names as well

try using following:
<% fields_for :shipping_customer do |sc| %>
<%= sc.text_field%>
<% end %>

    <% fields_for :billing do |bi| %>

…<%= b.text_field%>
<% end %>

<% fields_for :billing_customer do |bc| %>
…<%= bc.text_field%>
<% end %>

MOdel:

ShippingCustomer.new(params[:shipping_customer])
Billing.new(params[:billing)
ShippingCustomer.new(params[:billing_customer)

I am using something like this and it is working for me.

let me know

Ajit

Just what I needed. Many thanks, Ajit.