# Select

**URL:** <https://www.ruby-forum.com/t/select/141384>\
**Category:** Rails\
**Created:** [June 25, 2008, 9:42am UTC](https://www.ruby-forum.com/t/select/141384 "2008-06-25T09:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 25, 2008, 9:42am UTC](https://www.ruby-forum.com/t/select/141384/1 "2008-06-25T09:42:52Z")

</div>

Hi  
I have a select as below.This select is replaced to a div when I  
call observer\_field update  
\<%= select( “sd\_ticket”, “service\_desk\_sub\_category\_id”,  
ServiceDeskSubCategory.find(:all, :conditions =\>  
[“service\_desk\_category\_id =?”, @category\_id] ).collect {|p| [ p.name,  
p.id ] }) %\>

```
 Here in above code how can I forcefully set the html option

```

selected…For example say select last record as selected

Thanks in advance  
Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 25, 2008, 10:21am UTC](https://www.ruby-forum.com/t/select/141384/2 "2008-06-25T10:21:23Z")

</div>

You can use :selected =\> value.

See

> **[ActionView::Helpers::FormOptionsHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M001749)**
>
> Provides a number of methods for turning different kinds of containers into a set of option tags.
