How to get the value of Collection_select in controller


#1

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 :frowning:
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


#2

Use:

params[:user][:province_id]

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

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


#3

Maurício Linhares wrote:

Use:

params[:user][:province_id]

Maur�cio Linhares
http://alinhavado.wordpress.com/ (pt-br) | 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 :slight_smile: