# Select() based on get parameters

**URL:** <https://www.ruby-forum.com/t/select-based-on-get-parameters/131600>\
**Category:** Rails\
**Created:** [March 11, 2008, 8:33pm UTC](https://www.ruby-forum.com/t/select-based-on-get-parameters/131600 "2008-03-11T20:33:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_CSHess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/94ad74/32.png) [@Sean\_CSHess](https://www.ruby-forum.com/u/Sean_CSHess)\
**Post date:** [March 11, 2008, 8:33pm UTC](https://www.ruby-forum.com/t/select-based-on-get-parameters/131600/1 "2008-03-11T20:33:35Z")

</div>

I’m still very new to rails, so tell me if I’m approaching this  
stupidly.

I have a box that I want to filter some search results. I  
already made it so when they change the value, it goes to the url: /  
game/list/?players=3

Now, I can update the search easily enough, but how can I show the  
correct value in the select box? It always goes back to the top (my  
prompt value)

Here’s what I have  
\<%= select(:get, :players, Player.find(:all).collect {|  
p| [p.name, p.id] }, {:prompt =\> ‘Any # of Players’ }) %\>

I am changing the url with javascript elsewhere. This, however, never  
picks up the players from the url.

How can I do this?  
Thanks  
~sean
