# Collection\_select

**URL:** <https://www.ruby-forum.com/t/collection-select/143964>\
**Category:** Rails\
**Created:** [July 24, 2008, 7:47am UTC](https://www.ruby-forum.com/t/collection-select/143964 "2008-07-24T07:47:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [July 24, 2008, 7:47am UTC](https://www.ruby-forum.com/t/collection-select/143964/1 "2008-07-24T07:47:23Z")

</div>

Hi,  
i am using one collection select in my application,  
and i am trying to set the value which i am selected,but i  
unable to fixed it.It always refer to first value.Here is my  
code,what is wrong in this code,  
and what is the appropriate code.please help.

```
 <%= collection_select(:employeedetails, :EmpNo,

```

@emprecord,:EmpNo,:Employee\_Name,{:selected=\>Employee\_Name},{:class =\>  
“abc”})%\>  
and in controller::  
@emprecord=EmployeeDetails.find\_by\_sql(“select \* from  
EmployeeDetails”)
