Routing is defined in app/application.rb like all other search specific options.
app/application.rb
class PickySearch < Application # ... route %r{^/books/full} => full_books_query route %r{^/books/live} => live_books_query root 200 end
root 200 is convenience for route %r{^/$} => an empty 200 success response
root 200
route %r{^/$} => an empty 200 success response
It’s simple. route maps multiple (or just one) path matching regexps to queries.
route
class PickySearch < Application # ... my_query = Query::Full.new my_beautiful_books_index route %r{^/books/full} => my_query end
This will match all URL paths beginning with /books/full and map the request to the query my_query.
/books/full
my_query
route has another trick up its sleeve, it can also match a query param (just a single one):
route %r{^/books} => my_query, :some_type => :full
This will match only /books...?some_type=full.
/books...?some_type=full
There was an error while loading. Please reload this page.