Hey All,
What’s the right way to make a list of something (games in my case)
but filtered by various parameters? For example, I have /game/list
showing all games, but if they specify /game/list/?
category=3&players=5 I want to show all games in that category that
allow 5 players.
Right now, I can get the category’s games by using
if defined? params[:category]
@games = Category.find(params[:category]).games;
end
and I can get the players by using
if params[:players].to_i > 0
@games = Game.find(:all, :conditions => ['players = ?',
params[:players]]);
end
But how can I do both?