# Struggling with collect

**URL:** <https://www.ruby-forum.com/t/struggling-with-collect/133184>\
**Category:** Rails\
**Created:** [March 28, 2008, 4:24pm UTC](https://www.ruby-forum.com/t/struggling-with-collect/133184 "2008-03-28T16:24:22Z")\
**Posts on this page:** 2\
**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 28, 2008, 4:24pm UTC](https://www.ruby-forum.com/t/struggling-with-collect/133184/1 "2008-03-28T16:24:22Z")

</div>

I use a lot of this but I am struggling to get it to show the 'selected  
value.

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

This is fine but I want it to show the currently selected value.

How would I modify the above to show the current value (Either fac.name  
or fac.id)?

@counseling\_note.fi\_facility\_id = 9  
@counseling\_note.fi\_facility = “Some Facility Name”  
or I can set @fi\_facility  
or I can set @fi\_facility\_id

but I can’t get it to show the selected value.

Craig

---

<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 29, 2008, 5:19am UTC](https://www.ruby-forum.com/t/struggling-with-collect/133184/2 "2008-03-29T05:19:49Z")

</div>

On Mon, 2008-03-24 at 14:28 -0700, Craig W. wrote:

> How would I modify the above to show the current value (Either fac.name  
> or fac.id)?
> 
> @counseling\_note.fi\_facility\_id = 9  
> @counseling\_note.fi\_facility = “Some Facility Name”  
> or I can set @fi\_facility  
> or I can set @fi\_facility\_id
> 
> but I can’t get it to show the selected value.

* * *

obviously people can ignore this e-mail and the one that followed an  
hour later when this one didn’t show up because the issue was solved.

What is a mystery is how google groups seemingly ‘lost’ these and I  
notice some other older e-mails from various other senders also showed  
up on the list today.

Looking at the headers, it’s clear that these e-mails were received by  
Google in a timely manner but they hung around for 4 days before going  
out to the list.

Craig
