Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Clarify options_from_collection_for_select example

#1348

I'm not sure if I'm doing this correctly.. I'm using the diff from Github. Please bear with me, and let me know if I should submit this differently?

@@ -207,6 +207,11 @@ module ActionView 0

   # options_from_collection_for_select(@project.people, "id", "name")

0

   # <option value="#{person.id}">#{person.name}</option>

0

   #

0 + # Example (call, result). When specifying +selected+ using an ID be sure to pass an Integer rather than a string: 0 + # options_from_collection_for_select(@project.people, "id", "name", some_id.to_i) 0 + #

#{person.name} 0 + # #{person.name} #assume some_id was a string value of this person.id 0 + # 0
   # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.

0

   def options_from_collection_for_select(collection, value_method, text_method, selected = nil)

0

     options = collection.map do |element|

Reported by revgum · November 8th, 2008 @ 07:08 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. revgum
    revgum

    here's the patch file, sorry for the poor first attempt!

    November 8th, 2008 @ 07:22 PM

  2. Pratik
    Pratik
    • State changed from new to wontfix

    If you PM me ( lifo ) at github, then I can add you to docrails ( http://github.com/lifo/docrails ) and you can commit the patch yourself.

    Thanks!

    December 19th, 2008 @ 02:32 PM