我想匹配这条路
/news_entries?category_id=7
在这里重定向我:
/categories/7/news_entries
此代码不起作用:
match '/news_entries?category_id=:category_id' => redirect("/categories/%{category_id}/news_entries")
我尝试使用约束(http://guides.rubyonrails.org/routing.html#advanced-constraints),但在这种情况下,我不知道如何将 category_id 参数放入匹配字符串中。