diff --git a/railties/guides/source/2_3_release_notes.textile b/railties/guides/source/2_3_release_notes.textile index cc2e2dc20c..7f617a6763 100644 --- a/railties/guides/source/2_3_release_notes.textile +++ b/railties/guides/source/2_3_release_notes.textile @@ -365,6 +365,17 @@ You can write this view in Rails 2.3: <% end %> +When nesting across a +has_one+ relationship you will need to create a new blank object for the nested object before calling +fields_for+ in the view. + +A +build_<model_name>+ method has been created for this purpose: + + + <% @customer.build_order unless @customer.order %> + <% customer_form.fields_for :orders do |order_form| %> + + +Otherwise +@customer.order+ will return +nil+ and your form will fail. +has_many+ relationships do not require this extra step. + * Lead Contributor: "Eloy Duran":http://www.superalloy.nl/blog/ * More Information: ** "Nested Model Forms":http://weblog.rubyonrails.org/2009/1/26/nested-model-forms