# Another try with a collect problem

**URL:** <https://www.ruby-forum.com/t/another-try-with-a-collect-problem/132913>\
**Category:** Rails\
**Created:** [March 25, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/another-try-with-a-collect-problem/132913 "2008-03-25T19:11:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [March 25, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/another-try-with-a-collect-problem/132913/1 "2008-03-25T19:11:29Z")

</div>

Trying to figure out how to indicated ‘selected’ value in multi-valued  
collect…

\<%= select ‘counseling\_note’, ‘fi\_facility\_id’, [[‘Select Facility’,  
‘’ ] ] + @facilities.sort { |a,b| a.name \<=\> b.name }.collect { |fac|  
[fac.name, fac.id] }, :selected =\> @fi\_facility\_id %\>

but the :selected =\> doesn’t work

I can provide it either/both fac.name and fac.id but no matter what I  
do, I can’t get the select list to display the currently selected  
value.

Any suggestions?
