# Collection\_select with :selected option

**URL:** <https://www.ruby-forum.com/t/collection-select-with-selected-option/90521>\
**Category:** Rails\
**Created:** [March 29, 2007, 2:28pm UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521 "2007-03-29T14:28:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [March 29, 2007, 2:28pm UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521/1 "2007-03-29T14:28:43Z")

</div>

Hi there.

I know that there are a lot of solutions that have been discussed for  
this issue here already. However none of them did work for me. Either  
the selected option did work, but not “:include\_blank =\> true” or my  
AJAX-code gots messed-up.

Is there a final solution for this?

Here my code:

\<%= collection\_select(“category\_selection”, “super\_category\_id”,  
@super\_categories, :super\_category\_id, :name,  
@selected\_super\_category\_id,  
{:onChange =\> remote\_function(:update =\>  
“box\_search”,  
:url =\> {:action  
=\> :search\_by\_category},  
:submit =\>  
“category\_selection\_super\_category”) } ) -%\>

Thanks  
David

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [March 30, 2007, 9:23am UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521/2 "2007-03-30T09:23:55Z")

</div>

Hey. Is there nobody using this?

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [March 30, 2007, 11:52am UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521/3 "2007-03-30T11:52:48Z")

</div>

Hi, could you explain what you’re trying to do exactly so that people  
can chime in?

-Conrad

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [March 30, 2007, 1:08pm UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521/4 "2007-03-30T13:08:06Z")

</div>

Conrad T. wrote:

> Hi, could you explain what you’re trying to do exactly so that people  
> can chime in?

Hi. I’m trying to generate a HTML select-tag including the selected  
option from a model object.

I’ve tried this with the collection\_select, which does not include the  
selected option. I’ve also tried options\_from\_collection\_for\_select,  
which worked unless a blank option was included.

Thanks  
David

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [May 8, 2007, 7:46pm UTC](https://www.ruby-forum.com/t/collection-select-with-selected-option/90521/5 "2007-05-08T19:46:28Z")

</div>

Have a look here: [http://shiningthrough.co.uk/blog/show/6](http://shiningthrough.co.uk/blog/show/6)

On Mar 30, 12:08 pm, David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
