aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/form_helpers.textile
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/form_helpers.textile')
-rw-r--r--guides/source/form_helpers.textile4
1 files 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
<erb>
# view:
-<%= select(:person, :city_id, [['Lisbon', 1], ['Madrid', 2], ...]) %>
+<%= f.select(:person, :city_id, [['Lisbon', 1], ['Madrid', 2], ...]) %>
</erb>
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.