diff options
author | Dan Patrick <dan@mdpatrick.com> | 2012-07-08 19:53:02 -0500 |
---|---|---|
committer | Dan Patrick <dan@mdpatrick.com> | 2012-07-08 19:53:02 -0500 |
commit | bf97795e7327e15774666d2197f1c0b8ada57a84 (patch) | |
tree | 2b0bbda781606f6c80d6972dc8cf8c80c488e66b /guides/source | |
parent | 3cebfa49e1c9b03476b0f80dfe597a49e534fc33 (diff) | |
download | rails-bf97795e7327e15774666d2197f1c0b8ada57a84.tar.gz rails-bf97795e7327e15774666d2197f1c0b8ada57a84.tar.bz2 rails-bf97795e7327e15774666d2197f1c0b8ada57a84.zip |
Select missing formbuilder typo.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/form_helpers.textile | 4 |
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. |