# select

**URL:** <https://discuss.rubyonrails.org/t/select/31051>\
**Category:** rubyonrails-talk\
**Created:** [June 25, 2008, 7:42am UTC](https://discuss.rubyonrails.org/t/select/31051 "2008-06-25T07:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [June 25, 2008, 7:42am UTC](https://discuss.rubyonrails.org/t/select/31051/1 "2008-06-25T07:42:52Z")

</div>

Hi &nbsp;&nbsp;&nbsp;&nbsp;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] }) %\>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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:** ![Koraktor](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@Koraktor](https://discuss.rubyonrails.org/u/Koraktor)\
**Post date:** [June 25, 2008, 8:16am UTC](https://discuss.rubyonrails.org/t/select/31051/2 "2008-06-25T08:16:26Z")

</div>

You can use :selected =\> value.

See [http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M001749](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M001749)
