From bf97795e7327e15774666d2197f1c0b8ada57a84 Mon Sep 17 00:00:00 2001 From: Dan Patrick Date: Sun, 8 Jul 2012 19:53:02 -0500 Subject: [PATCH] Select missing formbuilder typo. --- guides/source/form_helpers.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/form_helpers.textile b/guides/source/form_helpers.textile index 58338ce54b..672bd3dd33 100644 --- a/guides/source/form_helpers.textile +++ b/guides/source/form_helpers.textile @@ -442,7 +442,7 @@ In most cases form controls will be tied to a specific database model and as you # view: -<%= select(:person, :city_id, [['Lisbon', 1], ['Madrid', 2], ...]) %> +<%= f.select(:person, :city_id, [['Lisbon', 1], ['Madrid', 2], ...]) %> Notice that the third parameter, the options array, is the same kind of argument you pass to +options_for_select+. One advantage here is that you don't have to worry about pre-selecting the correct city if the user already has one -- Rails will do this for you by reading from the +@person.city_id+ attribute. @@ -942,4 +942,4 @@ As a convenience you can instead pass the symbol +:all_blank+ which will create h4. Adding Fields on the Fly -Rather than rendering multiple sets of fields ahead of time you may wish to add them only when a user clicks on an 'Add new child' button. Rails does not provide any builtin support for this. When generating new sets of fields you must ensure the the key of the associated array is unique - the current javascript date (milliseconds after the epoch) is a common choice. \ No newline at end of file +Rather than rendering multiple sets of fields ahead of time you may wish to add them only when a user clicks on an 'Add new child' button. Rails does not provide any builtin support for this. When generating new sets of fields you must ensure the the key of the associated array is unique - the current javascript date (milliseconds after the epoch) is a common choice.