# How to get the value of Collection\_select in controller

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-value-of-collection-select-in-controller/160372>\
**Category:** Rails\
**Created:** [February 15, 2009, 1:40pm UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-collection-select-in-controller/160372 "2009-02-15T13:40:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [February 15, 2009, 1:40pm UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-collection-select-in-controller/160372/1 "2009-02-15T13:40:45Z")

</div>

this is my view code  
\<%= f.collection\_select(:user, :province\_id , @provinces ,:id , :name)  
%\>  
and this is my  
controller code

params[:user\_province\_id]

it is giving nothing ☹  
when i use observe field and use “params[:user\_province\_id]” in  
controller then it gives the value easily.

but when i submit the form, this collection\_select gives me nothing.

i dont know what is the problem .  
plz n e one help me out

thanx in advance

---

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [February 15, 2009, 5:19pm UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-collection-select-in-controller/160372/2 "2009-02-15T17:19:50Z")

</div>

Use:

params[:user][:province\_id]

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

On Sun, Feb 15, 2009 at 9:40 AM, Hamid R.

---

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [February 15, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-collection-select-in-controller/160372/3 "2009-02-15T22:01:33Z")

</div>

MaurÃ­cio Linhares wrote:

> Use:
> 
> params[:user][:province\_id]
> 
> - 
> 
> Maurï¿½cio Linhares  
> [http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
> (en)
> 
> On Sun, Feb 15, 2009 at 9:40 AM, Hamid R.

Thanks a lot MaurÃ­cio Linhares. It worked for me 🙂
