aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/2_3_release_notes.textile
diff options
context:
space:
mode:
authorAnton Jenkins <anton@pixellatedvisions.com>2009-03-19 16:23:14 +0000
committerAnton Jenkins <anton@pixellatedvisions.com>2009-03-19 16:23:14 +0000
commit3d3a74f07fe192cddeb6084e15f16fa08c451499 (patch)
tree97d66bf7a87294831a8432c859bf9cfad5389844 /railties/guides/source/2_3_release_notes.textile
parente8501a15a84f4c0d894273b0decedf64cce66c76 (diff)
downloadrails-3d3a74f07fe192cddeb6084e15f16fa08c451499.tar.gz
rails-3d3a74f07fe192cddeb6084e15f16fa08c451499.tar.bz2
rails-3d3a74f07fe192cddeb6084e15f16fa08c451499.zip
Added extra notes to nested model forms explanation in 2.3 release notes to cover has_one relationships
Diffstat (limited to 'railties/guides/source/2_3_release_notes.textile')
-rw-r--r--railties/guides/source/2_3_release_notes.textile11
1 files changed, 11 insertions, 0 deletions
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 %>
</erb>
+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_&lt;model_name&gt;+ method has been created for this purpose:
+
+<erb>
+ <% @customer.build_order unless @customer.order %>
+ <% customer_form.fields_for :orders do |order_form| %>
+</erb>
+
+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