Permutation on Rails Routes
- by Kevin Sylvestre
I currently have an application that for a set of parameters (location, category, budget, ...) a user can enter a "pretty" URL like:
/location/canada/ontario
/category/primary
/budget/small
Resulting in the respective parameters:
params[:country] == 'canada' and params[:region] == 'ontario'
params[:category] == 'primary'
params[:budget] == 'small'
I want to allow users to perform searches on multiple parameters at once (with each parameter optional). For example:
/location/canada/ontario/category/primary/budget/small
I understand that this can be achieved using URL parameters, but for SEO reasons I prefer to add the "pretty" parameters. Is this at all possible without listing all possible combination of routes (I have a large number of search-able fields)? I understand that route "globbing" maybe play a roll, but I am not sure how.
Thanks.