3 ms·
the right way to do URL parameters is probably to make them RESTful and add a route. I respectfully disagree. REST just means interpreting an HTTP verb as a l
by patio11 18y ago
the right way to do URL parameters is probably to make them RESTful and add a route.
I respectfully disagree. REST just means interpreting an HTTP verb as a logical action, it doesn't mean we wage holy war against the heretical question marks. Query parameters remain useful for, e.g., allowing one route to take a number of optional parameters:
/sales/report?year=2008
/sales/report?year=2008&vendor_id=1
/sales/report?year=2008&vendor_id=1&expense_category_id=12
Now if all three of those parameters are optional, that is eight unique RESTful routes you'd have to write (map.sales_report_for_vendor_and_expense_category '/sales/report/vendor/:vendor_id/expense_category/:expense_category_id/'... times eight), which doesn't sound DRY to me at all.