I may be totally wrong about what the fields_for method is supposed to
do, but for some reason I thought using it scoped an object around an
association.

For example, I have a User class and when you're creating a new user I
want to use fields_for to add a BillingAddress to the user like so:

<%- fields_for :billing_address do |billing_address_form| -%>
  <%= render :partial => 'billing_addresses/form', :locals => { :f =>
billing_address_form } %>
<%- end -%>


This however, is not scoping the user object around the billing address
form fields because when I view source, I see this:

<p>
  <label for="billing_address_address_one">Address one</label><br />
  <input id="billing_address_address_one"
name="billing_address[address_one]" size="30" type="text" />
</p>
<p>
  <label for="billing_address_address_two">Address two</label><br />
  <input id="billing_address_address_two"
name="billing_address[address_two]" size="30" type="text" />
</p>

I'm using Rails 2.2.2 and maybe this never worked the way I'm thinking
it should, or I could be doing something wrong...

Any suggestions anyone?

Thanks,
Josh
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to