From 4f3e82f7f750d93a778cd9961a2cfe1f8e831590 Mon Sep 17 00:00:00 2001 From: rev Date: Sat, 8 Nov 2008 11:19:13 -0800 Subject: [PATCH] added doc clarification example for options_from_collection_for_select --- .../lib/action_view/helpers/form_options_helper.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 33f8aaf..f629862 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -207,6 +207,11 @@ module ActionView # options_from_collection_for_select(@project.people, "id", "name") # # + # Example (call, result). When specifying +selected+ using an ID be sure to pass an Integer rather than a string: + # options_from_collection_for_select(@project.people, "id", "name", some_id.to_i) + # + # #assume some_id was a string value of this person.id + # # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def options_from_collection_for_select(collection, value_method, text_method, selected = nil) options = collection.map do |element| -- 1.6.0.2