I have a list of games that I want to filter by # of players and
category. I want to be able to list either or both parameters and
have it work. I don’t know how to make the players box
generate the GET requests I want (see below)
The urls would look like the following. As you can see, right now I
don’t want to have to specify all the parameters
The _filter template includes a box for the # of players, and
links for the categories. The categories generate the right urls if
they use the following helper.
def filtered_games_path §
temp = params.dup
p.each do |key, value| temp[key] = value end games_path(temp)
So, something like this: <%= link_to category.name,
filtered_games_path (:category => category.id ) %> would translate to
either /games?category=N or /games?players=M&category=N, depending on
whether or not players was already one of the parameters.
But now I need to do the same thing for a select box. I want it to
make a get request as soon as it is changed – so it’s just a fancy
link that allows you to change which # you are sending for the players
generate the url with rails, so I don’t have to repeat the code that
merges the parameters.
Thanks, and let me know if that doesn’t make sense